Package: org.grails.validation

## [Java] Class DefaultConstraintEvaluator

- org.grails.validation.DefaultConstraintEvaluator

- All Implemented Interfaces and Traits:
    ConstraintsEvaluator

      public class DefaultConstraintEvaluator
      extends java.lang.Object

  Default implementation of the ConstraintsEvaluator interface. TODO: Subclass this to add hibernate-specific exceptions!

  Authors:
    Graeme Rocher
  Since:
    2.0

- - ### Constructor Summary

    Constructors
    Constructor and description
    `DefaultConstraintEvaluator (java.util.Map<java.lang.String, java.lang.Object> defaultConstraints)`
    `DefaultConstraintEvaluator ()`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `protected void` | `applyDefaultConstraints(GrailsDomainClassProperty domainClassProperty, Constrained constrained, java.util.Map<java.lang.String, java.lang.Object> defaultConstraints)`
    `` | `protected void` | `applyDefaultConstraints(java.lang.String propertyName, Constrained constrained)`
    `` | `protected void` | `applyDefaultNullableConstraint(GrailsDomainClassProperty domainClassProperty, Constrained constrained)`
    `` | `protected void` | `applyDefaultNullableConstraint(Constrained constrained, boolean defaultNullable)`
    `` | `protected void` | `applyMapOfConstraints(java.util.Map<java.lang.String, java.lang.Object> constraints, java.lang.String propertyName, GrailsDomainClassProperty domainClassProperty, Constrained constrained)`
    `` | `protected void` | `applySharedConstraints(ConstrainedPropertyBuilder constrainedPropertyBuilder, java.util.Map<java.lang.String, Constrained> constraintMap)`
    `` | `protected boolean` | `canApplyNullableConstraint(java.lang.String propertyName, GrailsDomainClassProperty property, Constrained constrained)`
    `` | `protected boolean` | `canPropertyBeConstrained(GrailsDomainClassProperty property)`
    `` | `java.util.Map<java.lang.String, Constrained>` | `evaluate(java.lang.Class cls)`
    `` | `java.util.Map<java.lang.String, Constrained>` | `evaluate(java.lang.Class cls, boolean defaultNullable)`
    `` | `java.util.Map<java.lang.String, Constrained>` | `evaluate(java.lang.Class<?> cls, boolean defaultNullable, boolean useOnlyAdHocConstraints, groovy.lang.Closure... adHocConstraintsClosures)`
    `` | `java.util.Map<java.lang.String, Constrained>` | `evaluate(GrailsDomainClass cls)`
    `` | `java.util.Map<java.lang.String, Constrained>` | `evaluate(java.lang.Object object, GrailsDomainClassProperty[] properties)`
    `` | `java.util.Map<java.lang.String, Constrained>` | `evaluate(java.lang.Class<?> cls, GrailsDomainClassProperty[] properties)`
    `` | `protected java.util.Map<java.lang.String, Constrained>` | `evaluateConstraints(java.lang.Class<?> theClass, GrailsDomainClassProperty[] domainClassProperties)` Evaluates the constraints closure to build the list of constraints
    `` | `protected java.util.Map<java.lang.String, Constrained>` | `evaluateConstraints(java.lang.Class<?> theClass, GrailsDomainClassProperty[] domainClassProperties, boolean defaultNullable)` Evaluates the constraints closure to build the list of constraints
    `` | `protected java.util.Map<java.lang.String, Constrained>` | `evaluateConstraints(java.lang.Class<?> theClass, GrailsDomainClassProperty[] domainClassProperties, boolean defaultNullable, boolean useOnlyAdHocConstraints, groovy.lang.Closure[] adHocConstraintsClosures)`
    `` | `protected java.util.Map<java.lang.String, Constrained>` | `evaluateConstraints(java.util.Map<java.lang.String, Constrained> constraintMap, java.lang.Class<?> theClass, GrailsDomainClassProperty[] domainClassProperties, boolean defaultNullable)`
    `` | `protected java.util.Map<java.lang.String, Constrained>` | `evaluateConstraintsMap(java.util.List<groovy.lang.Closure> constraintsClosureList, java.lang.Class<?> theClass)`
    `` | `protected java.util.Map<java.lang.String, java.lang.reflect.Method>` | `getConstrainablePropertyMap(java.lang.Class theClass, boolean isDomainClass)`
    `` | `protected groovy.lang.Closure<?>` | `getConstraintsFromScript(java.lang.Class<?> theClass)`
    `` | `java.util.Map<java.lang.String, java.lang.Object>` | `getDefaultConstraints()`
    `` | `protected java.util.Map<java.lang.String, GrailsDomainClassProperty>` | `indexPropertiesByPropertyName(GrailsDomainClassProperty[] properties)`
    `` | `protected boolean` | `isAssociationIdProperty(java.lang.String propertyName, java.util.Map<java.lang.String, GrailsDomainClassProperty> domainClassPropertyMap)`
    `` | `protected boolean` | `isConstrainableProperty(GrailsDomainClassProperty domainClassProperty, java.lang.String propertyName)`
    `` | `protected java.util.List<groovy.lang.Closure>` | `retrieveConstraintsClosures(java.lang.Class<?> theClass)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `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

    - #### public DefaultConstraintEvaluator(java.util.Map<java.lang.String, java.lang.Object> defaultConstraints)

    - #### public DefaultConstraintEvaluator()

  - ### Method Detail

    - #### @java.lang.SuppressWarnings("unchecked") protected void applyDefaultConstraints(GrailsDomainClassProperty domainClassProperty, Constrained constrained, java.util.Map<java.lang.String, java.lang.Object> defaultConstraints)

    - #### @java.lang.SuppressWarnings("unchecked") protected void applyDefaultConstraints(java.lang.String propertyName, Constrained constrained)

    - #### protected void applyDefaultNullableConstraint(GrailsDomainClassProperty domainClassProperty, Constrained constrained)

    - #### protected void applyDefaultNullableConstraint(Constrained constrained, boolean defaultNullable)

    - #### protected void applyMapOfConstraints(java.util.Map<java.lang.String, java.lang.Object> constraints, java.lang.String propertyName, GrailsDomainClassProperty domainClassProperty, Constrained constrained)

    - #### protected void applySharedConstraints(ConstrainedPropertyBuilder constrainedPropertyBuilder, java.util.Map<java.lang.String, Constrained> constraintMap)

    - #### protected boolean canApplyNullableConstraint(java.lang.String propertyName, GrailsDomainClassProperty property, Constrained constrained)

    - #### protected boolean canPropertyBeConstrained(GrailsDomainClassProperty property)

    - #### @java.lang.Override @java.lang.SuppressWarnings("unchecked") public java.util.Map<java.lang.String, Constrained> evaluate(@java.lang.SuppressWarnings("rawtypes") java.lang.Class cls)

    - #### @java.lang.Override @java.lang.SuppressWarnings("unchecked") public java.util.Map<java.lang.String, Constrained> evaluate(@java.lang.SuppressWarnings("rawtypes") java.lang.Class cls, boolean defaultNullable)

    - #### @java.lang.Override @java.lang.SuppressWarnings("unchecked") public java.util.Map<java.lang.String, Constrained> evaluate(java.lang.Class<?> cls, boolean defaultNullable, boolean useOnlyAdHocConstraints, groovy.lang.Closure... adHocConstraintsClosures)

    - #### @java.lang.Override @java.lang.SuppressWarnings("unchecked") public java.util.Map<java.lang.String, Constrained> evaluate(GrailsDomainClass cls)

    - #### @java.lang.Override public java.util.Map<java.lang.String, Constrained> evaluate(java.lang.Object object, GrailsDomainClassProperty[] properties)

    - #### @java.lang.Override public java.util.Map<java.lang.String, Constrained> evaluate(java.lang.Class<?> cls, GrailsDomainClassProperty[] properties)

    - #### protected java.util.Map<java.lang.String, Constrained> evaluateConstraints(java.lang.Class<?> theClass, GrailsDomainClassProperty[] domainClassProperties)

      Evaluates the constraints closure to build the list of constraints

      Parameters:
        `theClass` - The domain class to evaluate constraints for
        `domainClassProperties` - The properties of the instance
      Returns:
        A Map of constraints

    - #### protected java.util.Map<java.lang.String, Constrained> evaluateConstraints(java.lang.Class<?> theClass, GrailsDomainClassProperty[] domainClassProperties, boolean defaultNullable)

      Evaluates the constraints closure to build the list of constraints

      Parameters:
        `theClass` - The domain class to evaluate constraints for
        `domainClassProperties` - The properties of the instance
        `defaultNullable` - Indicates if properties are nullable by default
      Returns:
        A Map of constraints

    - #### protected java.util.Map<java.lang.String, Constrained> evaluateConstraints(java.lang.Class<?> theClass, GrailsDomainClassProperty[] domainClassProperties, boolean defaultNullable, boolean useOnlyAdHocConstraints, groovy.lang.Closure[] adHocConstraintsClosures)

    - #### protected java.util.Map<java.lang.String, Constrained> evaluateConstraints(java.util.Map<java.lang.String, Constrained> constraintMap, java.lang.Class<?> theClass, GrailsDomainClassProperty[] domainClassProperties, boolean defaultNullable)

    - #### protected java.util.Map<java.lang.String, Constrained> evaluateConstraintsMap(java.util.List<groovy.lang.Closure> constraintsClosureList, java.lang.Class<?> theClass)

    - #### protected java.util.Map<java.lang.String, java.lang.reflect.Method> getConstrainablePropertyMap(java.lang.Class theClass, boolean isDomainClass)

    - #### protected groovy.lang.Closure<?> getConstraintsFromScript(java.lang.Class<?> theClass)

    - #### @java.lang.Override public java.util.Map<java.lang.String, java.lang.Object> getDefaultConstraints()

    - #### protected java.util.Map<java.lang.String, GrailsDomainClassProperty> indexPropertiesByPropertyName(GrailsDomainClassProperty[] properties)

    - #### protected boolean isAssociationIdProperty(java.lang.String propertyName, java.util.Map<java.lang.String, GrailsDomainClassProperty> domainClassPropertyMap)

    - #### protected boolean isConstrainableProperty(GrailsDomainClassProperty domainClassProperty, java.lang.String propertyName)

    - #### protected java.util.List<groovy.lang.Closure> retrieveConstraintsClosures(java.lang.Class<?> theClass)