Package com.tryfinch.api.models
Class Individual
-
- All Implemented Interfaces:
public final class Individual
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceIndividual.VisitorAn interface that defines how to map each variant of Individual to a value of type T.
public final classIndividual.IndividualResponseBodypublic final classIndividual.BatchError
-
Method Summary
Modifier and Type Method Description final Optional<Individual.IndividualResponseBody>responseBody()final Optional<Individual.BatchError>batchError()final BooleanisResponseBody()final BooleanisBatchError()final Individual.IndividualResponseBodyasResponseBody()final Individual.BatchErrorasBatchError()final Optional<JsonValue>_json()final <T extends Any> Taccept(Individual.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final Individualvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static IndividualofResponseBody(Individual.IndividualResponseBody responseBody)final static IndividualofBatchError(Individual.BatchError batchError)-
-
Method Detail
-
responseBody
final Optional<Individual.IndividualResponseBody> responseBody()
-
batchError
final Optional<Individual.BatchError> batchError()
-
isResponseBody
final Boolean isResponseBody()
-
isBatchError
final Boolean isBatchError()
-
asResponseBody
final Individual.IndividualResponseBody asResponseBody()
-
asBatchError
final Individual.BatchError asBatchError()
-
accept
final <T extends Any> T accept(Individual.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.tryfinch.api.core.JsonValue; import java.util.Optional; Optional<String> result = individual.accept(new Individual.Visitor<Optional<String>>() { @Override public Optional<String> visitResponseBody(IndividualResponseBody responseBody) { return Optional.of(responseBody.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final Individual validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofResponseBody
final static Individual ofResponseBody(Individual.IndividualResponseBody responseBody)
-
ofBatchError
final static Individual ofBatchError(Individual.BatchError batchError)
-
-
-
-