public abstract class Validator<T> extends Object implements Predicate<T>
Predicate.test(Object)
and should override invalidMessage(Object)
.Constructor and Description |
---|
Validator() |
Modifier and Type | Method and Description |
---|---|
Validator<T> |
and(Validator<T> other)
Creates a new validator that is the conjunction of this one and the given one.
|
String |
invalidMessage(T argument)
Formulates an exception message for invalid values.
|
Validator<T> |
not()
Creates a new validator that is the negation of this one.
|
Validator<T> |
or(Validator<T> other)
Creates a new validator that is the disjunction of this one and the given one.
|
T |
validate(T argument)
Validates an argument.
|
public final T validate(T argument)
argument
- argument to validateIllegalArgumentException
- if validation failspublic String invalidMessage(T argument)
argument
- argument that failed validationpublic final Validator<T> and(Validator<T> other)
other
- other validatorpublic final Validator<T> or(Validator<T> other)
other
- other validatorCopyright © 2011–2019 The Apache Software Foundation. All rights reserved.