Interface Validated<T>
- All Known Implementing Classes:
Validated.Either,Validated.Invalid,Validated.None,Validated.Secret,Validated.Valid
Validation support for
MeterRegistryConfig.- Since:
- 1.5.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classstatic classstatic classIndicates that no validation has occurred.static classA specializationValidated.Validthat won't print the secret in plain text if the validation is serialized.static classA valid property value. -
Method Summary
Modifier and TypeMethodDescriptiondefault Validated<?> default List<Validated.Invalid<?>> failures()<U> Validated<U> flatMap(BiFunction<T, Validated.Valid<T>, Validated<U>> mapping) default <U> Validated<U> get()static <T> Validated.Invalid<T> invalid(String property, @Nullable Object value, String message, InvalidReason reason) static <T> Validated.Invalid<T> invalid(String property, @Nullable Object value, String message, InvalidReason reason, @Nullable Throwable exception) invalidateWhen(Predicate<T> condition, String message, InvalidReason reason) When the condition is met, turn aValidated.Validresult into anValidated.Invalidresult with the provided message.default booleanbooleanisValid()<U> Validated<U> nonBlank()static <T> Validated.None<T> none()default TvoidorThrow()required()static <T> Validated.Valid<T> static Validated.SecretvalidSecret(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
-
invalid
static <T> Validated.Invalid<T> invalid(String property, @Nullable Object value, String message, InvalidReason reason) -
invalid
static <T> Validated.Invalid<T> invalid(String property, @Nullable Object value, String message, InvalidReason reason, @Nullable Throwable exception) -
and
-
map
-
flatMap
-
flatMap
-
invalidateWhen
When the condition is met, turn aValidated.Validresult into anValidated.Invalidresult with the provided message.- Parameters:
condition-truewhen the property should be considered invalid.message- A message explaining the reason why the property is considered invalid.reason- An invalid reason.- Returns:
- When originally
Validated.Valid, apply the test and either retain the valid decision or make itValidated.Invalid. When originallyValidated.InvalidorValidated.None, don't apply the test at all, and pass through the original decision.
-
required
-
nonBlank
-
get
- Throws:
ValidationException
-
orElse
- Throws:
ValidationException
-
orElseGet
- Throws:
ValidationException
-
orThrow
- Throws:
ValidationException
-