ConstrainedProperty (Grails 3.1.7)
Date: 2016-05-19

Package: org.codehaus.groovy.grails.validation

## [Groovy] Class ConstrainedProperty

- org.codehaus.groovy.grails.validation.ConstrainedProperty

- Provides the ability to set contraints against a properties of a class. Constraints can either be set via the property setters or via the

      applyConstraint(String constraintName, Object constrainingValue)

  in combination with a constraint constant. Example: `... ConstrainedProperty cp = new ConstrainedProperty(owningClass, propertyName, propertyType); if (cp.supportsConstraint(ConstrainedProperty.EMAIL_CONSTRAINT)) { cp.applyConstraint(ConstrainedProperty.EMAIL_CONSTRAINT, new Boolean(true)); }` Alternatively constraints can be applied directly using the java bean getters/setters if a static (as oposed to dynamic) approach to constraint creation is possible: `cp.setEmail(true)`
  deprecated:
    Use ConstrainedProperty
  Authors:
    Graeme Rocher
  Since:
    07-Nov-2005

- - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class ConstrainedProperty` | `BLANK_CONSTRAINT, CREDIT_CARD_CONSTRAINT, DEFAULT_BLANK_MESSAGE_CODE, DEFAULT_DOESNT_MATCH_MESSAGE_CODE, DEFAULT_INVALID_CREDIT_CARD_MESSAGE_CODE, DEFAULT_INVALID_EMAIL_MESSAGE_CODE, DEFAULT_INVALID_MAX_MESSAGE_CODE, DEFAULT_INVALID_MAX_SIZE_MESSAGE_CODE, DEFAULT_INVALID_MIN_MESSAGE_CODE, DEFAULT_INVALID_MIN_SIZE_MESSAGE_CODE, DEFAULT_INVALID_RANGE_MESSAGE_CODE, DEFAULT_INVALID_SIZE_MESSAGE_CODE, DEFAULT_INVALID_URL_MESSAGE_CODE, DEFAULT_INVALID_VALIDATOR_MESSAGE_CODE, DEFAULT_MESSAGES, DEFAULT_NOT_EQUAL_MESSAGE_CODE, DEFAULT_NOT_INLIST_MESSAGE_CODE, DEFAULT_NULL_MESSAGE_CODE, EMAIL_CONSTRAINT, EXCEEDED_SUFFIX, INVALID_SUFFIX, IN_LIST_CONSTRAINT, LOG, MATCHES_CONSTRAINT, MAX_CONSTRAINT, MAX_SIZE_CONSTRAINT, MIN_CONSTRAINT, MIN_SIZE_CONSTRAINT, NOTMET_SUFFIX, NOT_EQUAL_CONSTRAINT, NOT_PREFIX, NULLABLE_CONSTRAINT, RANGE_CONSTRAINT, SCALE_CONSTRAINT, SIZE_CONSTRAINT, TOOBIG_SUFFIX, TOOLONG_SUFFIX, TOOSHORT_SUFFIX, TOOSMALL_SUFFIX, URL_CONSTRAINT, VALIDATOR_CONSTRAINT, appliedConstraints, bundle, constraints, messageSource, owningClass, propertyName, propertyType`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `ConstrainedProperty (java.lang.Class<?> clazz, java.lang.String propertyName, java.lang.Class<?> propertyType)` Constructs a new ConstrainedProperty for the given arguments.

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `static void` | `registerNewConstraint(java.lang.String name, ConstraintFactory factory)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class ConstrainedProperty` | `addMetaConstraint, applyConstraint, getAppliedConstraint, getAppliedConstraints, getAttributes, getFormat, getInList, getMatches, getMax, getMaxSize, getMetaConstraintValue, getMin, getMinSize, getNotEqual, getOrder, getOwner, getPropertyName, getPropertyType, getRange, getScale, getSize, getWidget, hasAppliedConstraint, hasRegisteredConstraint, isBlank, isCreditCard, isDisplay, isEditable, isEmail, isNullable, isPassword, isUrl, registerNewConstraint, registerNewConstraint, removeConstraint, removeConstraint, setAttributes, setBlank, setCreditCard, setDisplay, setEditable, setEmail, setFormat, setInList, setMatches, setMax, setMaxSize, setMessageSource, setMin, setMinSize, setNotEqual, setNullable, setOrder, setPassword, setPropertyName, setRange, setSize, setUrl, setWidget, supportsContraint, toString, validate`
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Constructor Detail

    - #### ConstrainedProperty(java.lang.Class<?> clazz, java.lang.String propertyName, java.lang.Class<?> propertyType)

      Constructs a new ConstrainedProperty for the given arguments.

      Parameters:
        `clazz` - The owning class
        `propertyName` - The name of the property
        `propertyType` - The property type

  - ### Method Detail

    - #### static void registerNewConstraint(java.lang.String name, ConstraintFactory factory)