public class ValidatorConstraint extends AbstractConstraint
A constraint class that validates using a user-supplied closure.
The Closure will receive one or two parameters containing the new value of the property and the object on which the validation is being performed. The value is always the first parameterm and the object is the second. These parameters must be type compatible with the value of the property and constrained class.
The Closure can return any of:
Constructor and Description |
---|
ValidatorConstraint() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getName() |
void |
setParameter(java.lang.Object constraintParameter)
The parameter which the constraint is validated against.
|
boolean |
supports(java.lang.Class type)
Returns whether the constraint supports being applied against the specified type;
|
getParameter, getPropertyName, isValid, rejectValue, rejectValue, rejectValue, rejectValue, rejectValue, rejectValueWithDefaultMessage, setMessageSource, setOwningClass, setPropertyName, toString, validate
public void setParameter(java.lang.Object constraintParameter)
Constraint
setParameter
in interface Constraint
setParameter
in class AbstractConstraint
constraintParameter
- The constraintParameter to set.public java.lang.String getName()
public boolean supports(java.lang.Class type)
Constraint
type
- The type to support