Class ConditionalValue
-
- All Implemented Interfaces:
public final class ConditionalValueA regex string, to be used with
MATCHESorDOES_NOT_MATCH
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceConditionalValue.VisitorAn interface that defines how to map each variant of ConditionalValue to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<String>regex()A regex string, to be used with MATCHESorDOES_NOT_MATCHfinal Optional<Long>number()A number, to be used with IS_GREATER_THAN,IS_GREATER_THAN_OR_EQUAL_TO,IS_LESS_THAN,IS_LESS_THAN_OR_EQUAL_TO,IS_EQUAL_TO, orIS_NOT_EQUAL_TOfinal Optional<List<String>>listOfStrings()An array of strings, to be used with IS_ONE_OForIS_NOT_ONE_OFfinal Optional<OffsetDateTime>timestamp()A timestamp, to be used with IS_AFTERorIS_BEFOREfinal BooleanisRegex()final BooleanisNumber()final BooleanisListOfStrings()final BooleanisTimestamp()final StringasRegex()A regex string, to be used with MATCHESorDOES_NOT_MATCHfinal LongasNumber()A number, to be used with IS_GREATER_THAN,IS_GREATER_THAN_OR_EQUAL_TO,IS_LESS_THAN,IS_LESS_THAN_OR_EQUAL_TO,IS_EQUAL_TO, orIS_NOT_EQUAL_TOfinal List<String>asListOfStrings()An array of strings, to be used with IS_ONE_OForIS_NOT_ONE_OFfinal OffsetDateTimeasTimestamp()A timestamp, to be used with IS_AFTERorIS_BEFOREfinal Optional<JsonValue>_json()final <T extends Any> Taccept(ConditionalValue.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final ConditionalValuevalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static ConditionalValueofRegex(String regex)A regex string, to be used with MATCHESorDOES_NOT_MATCHfinal static ConditionalValueofNumber(Long number)A number, to be used with IS_GREATER_THAN,IS_GREATER_THAN_OR_EQUAL_TO,IS_LESS_THAN,IS_LESS_THAN_OR_EQUAL_TO,IS_EQUAL_TO, orIS_NOT_EQUAL_TOfinal static ConditionalValueofListOfStrings(List<String> listOfStrings)An array of strings, to be used with IS_ONE_OForIS_NOT_ONE_OFfinal static ConditionalValueofTimestamp(OffsetDateTime timestamp)A timestamp, to be used with IS_AFTERorIS_BEFORE-
-
Method Detail
-
number
final Optional<Long> number()
A number, to be used with
IS_GREATER_THAN,IS_GREATER_THAN_OR_EQUAL_TO,IS_LESS_THAN,IS_LESS_THAN_OR_EQUAL_TO,IS_EQUAL_TO, orIS_NOT_EQUAL_TO
-
listOfStrings
final Optional<List<String>> listOfStrings()
An array of strings, to be used with
IS_ONE_OForIS_NOT_ONE_OF
-
timestamp
final Optional<OffsetDateTime> timestamp()
A timestamp, to be used with
IS_AFTERorIS_BEFORE
-
isListOfStrings
final Boolean isListOfStrings()
-
isTimestamp
final Boolean isTimestamp()
-
asNumber
final Long asNumber()
A number, to be used with
IS_GREATER_THAN,IS_GREATER_THAN_OR_EQUAL_TO,IS_LESS_THAN,IS_LESS_THAN_OR_EQUAL_TO,IS_EQUAL_TO, orIS_NOT_EQUAL_TO
-
asListOfStrings
final List<String> asListOfStrings()
An array of strings, to be used with
IS_ONE_OForIS_NOT_ONE_OF
-
asTimestamp
final OffsetDateTime asTimestamp()
A timestamp, to be used with
IS_AFTERorIS_BEFORE
-
accept
final <T extends Any> T accept(ConditionalValue.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.lithic.api.core.JsonValue; import java.util.Optional; Optional<String> result = conditionalValue.accept(new ConditionalValue.Visitor<Optional<String>>() { @Override public Optional<String> visitRegex(String regex) { return Optional.of(regex.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ConditionalValue 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.
-
ofRegex
final static ConditionalValue ofRegex(String regex)
A regex string, to be used with
MATCHESorDOES_NOT_MATCH
-
ofNumber
final static ConditionalValue ofNumber(Long number)
A number, to be used with
IS_GREATER_THAN,IS_GREATER_THAN_OR_EQUAL_TO,IS_LESS_THAN,IS_LESS_THAN_OR_EQUAL_TO,IS_EQUAL_TO, orIS_NOT_EQUAL_TO
-
ofListOfStrings
final static ConditionalValue ofListOfStrings(List<String> listOfStrings)
An array of strings, to be used with
IS_ONE_OForIS_NOT_ONE_OF
-
ofTimestamp
final static ConditionalValue ofTimestamp(OffsetDateTime timestamp)
A timestamp, to be used with
IS_AFTERorIS_BEFORE
-
-
-
-