Class CompoundFilter.Filter
-
- All Implemented Interfaces:
public final class CompoundFilter.FilterA filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceCompoundFilter.Filter.VisitorAn interface that defines how to map each variant of Filter to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<ComparisonFilter>comparison()A filter used to compare a specified attribute key to a given value using a defined comparison operation. final Optional<JsonValue>jsonValue()final BooleanisComparison()final BooleanisJsonValue()final ComparisonFilterasComparison()A filter used to compare a specified attribute key to a given value using a defined comparison operation. final JsonValueasJsonValue()final Optional<JsonValue>_json()final <T extends Any> Taccept(CompoundFilter.Filter.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final CompoundFilter.Filtervalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static CompoundFilter.FilterofComparison(ComparisonFilter comparison)A filter used to compare a specified attribute key to a given value using a defined comparison operation. final static CompoundFilter.FilterofJsonValue(JsonValue jsonValue)-
-
Method Detail
-
comparison
final Optional<ComparisonFilter> comparison()
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
isComparison
final Boolean isComparison()
-
isJsonValue
final Boolean isJsonValue()
-
asComparison
final ComparisonFilter asComparison()
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
asJsonValue
final JsonValue asJsonValue()
-
accept
final <T extends Any> T accept(CompoundFilter.Filter.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.openai.core.JsonValue; import java.util.Optional; Optional<String> result = filter.accept(new Filter.Visitor<Optional<String>>() { @Override public Optional<String> visitComparison(ComparisonFilter comparison) { return Optional.of(comparison.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final CompoundFilter.Filter 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.
-
ofComparison
final static CompoundFilter.Filter ofComparison(ComparisonFilter comparison)
A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
ofJsonValue
final static CompoundFilter.Filter ofJsonValue(JsonValue jsonValue)
-
-
-
-