Package org.openrewrite
Interface Validated
-
- All Superinterfaces:
java.lang.Iterable<Validated>
- All Known Implementing Classes:
Validated.Both
,Validated.Either
,Validated.Invalid
,Validated.Missing
,Validated.None
,Validated.Secret
,Validated.Valid
public interface Validated extends java.lang.Iterable<Validated>
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Validated.Both
static class
Validated.Either
static class
Validated.Invalid
static class
Validated.Missing
static class
Validated.None
Indicates that no validation has occurred.static class
Validated.Secret
A specializationValidated.Valid
that won't print the secret in plain text if the validation is serialized.static class
Validated.Valid
A valid property value.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Validated
and(Validated validated)
default java.util.List<Validated.Invalid>
failures()
<T> T
getValue()
static Validated.Invalid
invalid(java.lang.String property, @Nullable java.lang.Object value, java.lang.String message)
static Validated.Invalid
invalid(java.lang.String property, @Nullable java.lang.Object value, java.lang.String message, @Nullable java.lang.Throwable exception)
default boolean
isInvalid()
boolean
isValid()
static Validated.Missing
missing(java.lang.String property, @Nullable java.lang.Object value, java.lang.String message)
static Validated.None
none()
static Validated
notBlank(java.lang.String property, @Nullable java.lang.String value)
default Validated
or(Validated validated)
static Validated
required(java.lang.String property, @Nullable java.lang.Object value)
static <T> Validated
test(java.lang.String property, java.lang.String message, T value, java.util.function.Predicate<T> test)
Validate that the Predicate will evaluate to 'true' on the supplied value.static Validated.Valid
valid(java.lang.String property, @Nullable java.lang.Object value)
static Validated.Secret
validSecret(java.lang.String property, java.lang.String value)
-
-
-
Method Detail
-
isValid
boolean isValid()
-
isInvalid
default boolean isInvalid()
-
failures
default java.util.List<Validated.Invalid> failures()
-
validSecret
static Validated.Secret validSecret(java.lang.String property, java.lang.String value)
-
none
static Validated.None none()
-
valid
static Validated.Valid valid(java.lang.String property, @Nullable @Nullable java.lang.Object value)
-
test
static <T> Validated test(java.lang.String property, java.lang.String message, @Nullable T value, java.util.function.Predicate<T> 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
-
required
static Validated required(java.lang.String property, @Nullable @Nullable java.lang.Object value)
-
notBlank
static Validated notBlank(java.lang.String property, @Nullable @Nullable java.lang.String value)
-
missing
static Validated.Missing missing(java.lang.String property, @Nullable @Nullable java.lang.Object value, java.lang.String message)
-
invalid
static Validated.Invalid invalid(java.lang.String property, @Nullable @Nullable java.lang.Object value, java.lang.String message)
-
invalid
static Validated.Invalid invalid(java.lang.String property, @Nullable @Nullable java.lang.Object value, java.lang.String message, @Nullable @Nullable java.lang.Throwable exception)
-
getValue
@Nullable <T> T getValue()
-
-