Package org.openrewrite
Interface Validated<T>
- Type Parameters:
T
- the type of value being validated
- All Known Implementing Classes:
Validated.Both
,Validated.Either
,Validated.Invalid
,Validated.Missing
,Validated.None
,Validated.Secret
,Validated.Valid
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
static class
static class
static class
static class
Indicates that no validation has occurred.static class
A specializationValidated.Valid
that won't print the secret in plain text if the validation is serialized.static class
A valid property value. -
Method Summary
Modifier and TypeMethodDescriptiondefault List<Validated.Invalid<T>>
failures()
getValue()
static <T> Validated.Invalid<T>
static <T> Validated.Invalid<T>
default boolean
boolean
isValid()
static <T> Validated.Missing<T>
static <T> Validated.None<T>
none()
static <T> Validated<T>
static <T> Validated<T>
Validate that the Predicate will evaluate to 'true' on the supplied value.static <T,
V> Validated<T> Validate that the Predicate will evaluate to 'true' on the supplied value.static <T> Validated.Valid<T>
static Validated.Secret
validSecret
(String property, String value) Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
isValid
boolean isValid() -
isInvalid
default boolean isInvalid() -
failures
-
validSecret
-
none
-
valid
-
test
Validate that the Predicate will evaluate to 'true' on the supplied value. When the Predicate evaluates to 'false' the error message will be of the form:"[property] was '[value]' but it [message]"
- Type Parameters:
T
- The property value type.- Parameters:
property
- The property name to testmessage
- The failure message if the test doesn't passvalue
- The value of the propertytest
- The test predicate- Returns:
- A validation result
-
testNone
static <T,V> Validated<T> testNone(String property, String message, @Nullable V value, Predicate<V> test) Validate that the Predicate will evaluate to 'true' on the supplied value. Will return aValidated.None
if the value is valid.This allows validation of a value that is not the intended return value.
When the Predicate evaluates to 'false' the error message will be of the form:
"[property] was '[value]' but it [message]"
- Type Parameters:
T
- The property value type.- Parameters:
property
- The property name to testmessage
- The failure message if the test doesn't passvalue
- The value of the propertytest
- The test predicate- Returns:
- A validation result
-
required
-
notBlank
-
missing
-
invalid
-
invalid
-
and
-
or
-
getValue
-