Record Class ErrorResponse
java.lang.Object
java.lang.Record
net.ygbstudio.jbrave.api.response.ErrorResponse
- Record Components:
type- name of the errorerror- error response objecttime- timestamp
- All Implemented Interfaces:
ApiResponse
public record ErrorResponse(String type, ApiErrorModel error, Integer time)
extends Record
implements ApiResponse
Error response object that the Brave Search API sends in case the client's request results in
either 404, 422, or 429 http status codes.
This response record contains methods to deserialise and serialise instances.
Factory methods are available for String, File, Reader, and HttpResponse inputs. You can also write the contents of a response object to the filesystem;
write(File) can be useful for that purpose.
-
Constructor Summary
ConstructorsConstructorDescriptionErrorResponse(String type, ApiErrorModel error, Integer time) Creates an instance of aErrorResponserecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.error()Returns the value of theerrorrecord component.static ErrorResponsestatic ErrorResponsestatic ErrorResponsestatic ErrorResponsefrom(@NotNull HttpResponse<String> dataResponse) final inthashCode()Returns a hash code value for this object.time()Returns the value of thetimerecord component.toJson()Serializes the response object to a JSON string.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.voidWrites the response object to a file on the filesystem.
-
Constructor Details
-
Method Details
-
from
-
from
-
from
-
from
-
write
Description copied from interface:ApiResponseWrites the response object to a file on the filesystem.- Specified by:
writein interfaceApiResponse- Parameters:
target- the file to write the response object to.
-
toJson
Description copied from interface:ApiResponseSerializes the response object to a JSON string.- Specified by:
toJsonin interfaceApiResponse- Returns:
- a JSON string representation of the response object.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
error
Returns the value of theerrorrecord component.- Returns:
- the value of the
errorrecord component
-
time
Returns the value of thetimerecord component.- Returns:
- the value of the
timerecord component
-