use of org.grails.validation.EmailConstraint in project grails-core by grails.
the class ConstrainedProperty method setEmail.
/**
* @param email The email to set.
*/
public void setEmail(boolean email) {
if (!isValidStringType()) {
throw new ConstraintException("Email constraint can only be applied to String properties");
}
Constraint c = appliedConstraints.get(EMAIL_CONSTRAINT);
if (email) {
if (c == null) {
c = new EmailConstraint();
c.setOwningClass(owningClass);
c.setPropertyName(propertyName);
appliedConstraints.put(EMAIL_CONSTRAINT, c);
}
c.setParameter(true);
} else {
if (c != null) {
appliedConstraints.remove(EMAIL_CONSTRAINT);
}
}
}
Aggregations