Class ExampleValidationResult.Split
-
- All Implemented Interfaces:
public final class ExampleValidationResult.Split
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceExampleValidationResult.Split.VisitorAn interface that defines how to map each variant of Split to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<List<String>>strings()final Optional<String>string()final Optional<JsonValue>_json()final BooleanisStrings()final BooleanisString()final List<String>asStrings()final StringasString()final <T extends Any> Taccept(ExampleValidationResult.Split.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final ExampleValidationResult.Splitvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static ExampleValidationResult.SplitofStrings(List<String> strings)final static ExampleValidationResult.SplitofString(String string)-
-
Method Detail
-
accept
final <T extends Any> T accept(ExampleValidationResult.Split.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.langchain.smith.core.JsonValue; import java.util.Optional; Optional<String> result = split.accept(new Split.Visitor<Optional<String>>() { @Override public Optional<String> visitStrings(List<String> strings) { return Optional.of(strings.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ExampleValidationResult.Split 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.
-
ofStrings
final static ExampleValidationResult.Split ofStrings(List<String> strings)
-
ofString
final static ExampleValidationResult.Split ofString(String string)
-
-
-
-