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