Package dev.case.api.models.translate.v1
Class V1DetectParams.Q
-
- All Implemented Interfaces:
public final class V1DetectParams.QText to detect language for. Can be a single string or an array for batch detection.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceV1DetectParams.Q.VisitorAn interface that defines how to map each variant of Q to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<String>string()final Optional<List<String>>strings()final BooleanisString()final BooleanisStrings()final StringasString()final List<String>asStrings()final Optional<JsonValue>_json()final <T extends Any> Taccept(V1DetectParams.Q.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final V1DetectParams.Qvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static V1DetectParams.QofString(String string)final static V1DetectParams.QofStrings(List<String> strings)-
-
Method Detail
-
accept
final <T extends Any> T accept(V1DetectParams.Q.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 dev.case.api.core.JsonValue; import java.util.Optional; Optional<String> result = q.accept(new Q.Visitor<Optional<String>>() { @Override public Optional<String> visitString(String string) { return Optional.of(string.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final V1DetectParams.Q 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.
-
ofString
final static V1DetectParams.Q ofString(String string)
-
ofStrings
final static V1DetectParams.Q ofStrings(List<String> strings)
-
-
-
-