Class Validator<T>
java.lang.Object
com.chutneytesting.action.spi.validation.Validator<T>
Fluent validator
-
Method Summary
Modifier and TypeMethodDescriptionvoidgetErrorsFrom(Validator<?>... validators) booleanisValid()static <T> Validator<T>of(T toValidate) Buildervalidate(Function<? super T, ? extends U> projection, Predicate<? super U> validation, String message) Example : .validate(Person::getAge, a -> a >= 18, "should be eighteen or over");Example : .validate(Objects::nonNull, "should not be null")
-
Method Details
-
of
Builder -
validate
public <U> Validator<T> validate(Function<? super T, ? extends U> projection, Predicate<? super U> validation, String message) Example : .validate(Person::getAge, a -> a >= 18, "should be eighteen or over"); -
validate
Example : .validate(Objects::nonNull, "should not be null") -
addError
-
getErrorsFrom
-
isValid
public boolean isValid() -
getErrors
-