public interface Constraint
Known subtypesExistInConstraint, GroupConstraint, LengthConstraint, NotConstraint, NumericConstraint, RegexConstraint
To perform validation we add a constraint to a validator, a constraint defines whether a value if valid
for a given object
Methods
public abstract boolean isValid(Object value) | Indicates if the given value is valid or not |
public abstract String getDefaultFailMessage() | Includes the error message for the constraint |
Method details
isValid
public abstract boolean isValid(Object value)Indicates if the given value is valid or not
Parameters
valueObject- the value for the object
Returns
true if the value is valid and false otherwise
getDefaultFailMessage
public abstract String getDefaultFailMessage()Includes the error message for the constraint
Returns
the text of the error message for a constraint