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