Record Class SpellcheckSearchApiResponse
java.lang.Object
java.lang.Record
net.ygbstudio.jbrave.api.response.SpellcheckSearchApiResponse
- Record Components:
type- The type of the response.query- The original query submitted by the user.results- A list of spell check results provided by the API.
- All Implemented Interfaces:
ApiResponse
public record SpellcheckSearchApiResponse(String type, OriginalQuery query, List<SpellCheckResult> results)
extends Record
implements ApiResponse
Represents the response from the Brave Search API for spell check. This class contains the
original query and a list of spell check results.
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;
ApiResponse.write(File) can be useful for that purpose.
-
Constructor Summary
ConstructorsConstructorDescriptionSpellcheckSearchApiResponse(String type, OriginalQuery query, List<SpellCheckResult> results) Creates an instance of aSpellcheckSearchApiResponserecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static SpellcheckSearchApiResponseDeserializes aSpellcheckSearchApiResponsefrom a JSONFile.static SpellcheckSearchApiResponseDeserializes aSpellcheckSearchApiResponsefrom a JSONReader.static SpellcheckSearchApiResponseDeserializes aSpellcheckSearchApiResponsefrom a JSONString.static SpellcheckSearchApiResponsefrom(@NotNull HttpResponse<String> dataResponse) Deserializes aSpellcheckSearchApiResponsefrom the body of an HTTP response.final inthashCode()Returns a hash code value for this object.query()Returns the value of thequeryrecord component.results()Returns the value of theresultsrecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.ygbstudio.jbrave.api.response.ApiResponse
toJson, write
-
Constructor Details
-
SpellcheckSearchApiResponse
public SpellcheckSearchApiResponse(String type, OriginalQuery query, List<SpellCheckResult> results) Creates an instance of aSpellcheckSearchApiResponserecord class.
-
-
Method Details
-
from
Deserializes aSpellcheckSearchApiResponsefrom a JSONFile.- Parameters:
dataFile- the file containing the JSON response data- Returns:
- the deserialized response
-
from
Deserializes aSpellcheckSearchApiResponsefrom a JSONString.- Parameters:
dataString- the string containing the JSON response data- Returns:
- the deserialized response
-
from
Deserializes aSpellcheckSearchApiResponsefrom a JSONReader.- Parameters:
dataReader- the reader supplying the JSON response data- Returns:
- the deserialized response
-
from
Deserializes aSpellcheckSearchApiResponsefrom the body of an HTTP response.- Parameters:
dataResponse- the HTTP response whose body contains the JSON response data- Returns:
- the deserialized response
-
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
-
query
Returns the value of thequeryrecord component.- Returns:
- the value of the
queryrecord component
-
results
Returns the value of theresultsrecord component.- Returns:
- the value of the
resultsrecord component
-