Package: org.codehaus.groovy.grails.validation

## [Java] Interface Constraint

- org.springframework.beans.factory.Aware

- All Superinterfaces:
    org.springframework.beans.factory.Aware

  Defines a validatable constraint.

  Authors:
    Graeme Rocher

- - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `java.lang.String` | `getName()` @return The name of the constraint
    `java.lang.Object` | `getParameter()`
    `java.lang.String` | `getPropertyName()` @return The property name of the constraint
    `boolean` | `isValid()` Return whether the constraint is valid for the owning class
    `void` | `setMessageSource(org.springframework.context.MessageSource source)` The message source to evaluate the default messages from
    `void` | `setOwningClass(java.lang.Class owningClass)` The class the constraint applies to
    `void` | `setParameter(java.lang.Object parameter)` The parameter which the constraint is validated against.
    `void` | `setPropertyName(java.lang.String propertyName)` The name of the property the constraint applies to
    `boolean` | `supports(java.lang.Class type)` Returns whether the constraint supports being applied against the specified type;
    `void` | `validate(java.lang.Object target, java.lang.Object propertyValue, org.springframework.validation.Errors errors)` Validate this constraint against a property value.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `interface org.springframework.context.MessageSourceAware` | `org.springframework.context.MessageSourceAware#setMessageSource(org.springframework.context.MessageSource)`
    `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()`

- - ### Method Detail

    - #### public java.lang.String getName()

      Returns:
        The name of the constraint

    - #### public java.lang.Object getParameter()

    - #### public java.lang.String getPropertyName()

      Returns:
        The property name of the constraint

    - #### public boolean isValid()

      Return whether the constraint is valid for the owning class

      Returns:
        true if it is

    - #### public void setMessageSource(org.springframework.context.MessageSource source)

      The message source to evaluate the default messages from

      Parameters:
        source

    - #### @java.lang.SuppressWarnings("rawtypes") public void setOwningClass(java.lang.Class owningClass)

      The class the constraint applies to

      Parameters:
        owningClass

    - #### public void setParameter(java.lang.Object parameter)

      The parameter which the constraint is validated against.

      Parameters:
        parameter

    - #### public void setPropertyName(java.lang.String propertyName)

      The name of the property the constraint applies to

      Parameters:
        propertyName

    - #### @java.lang.SuppressWarnings("rawtypes") public boolean supports(java.lang.Class type)

      Returns whether the constraint supports being applied against the specified type;

      Parameters:
        `type` - The type to support
      Returns:
        true if the constraint can be applied against the specified type

    - #### public void validate(java.lang.Object target, java.lang.Object propertyValue, org.springframework.validation.Errors errors)

      Validate this constraint against a property value. If implementation is vetoing (isVetoing() method returns true), then it could return 'true' to stop further validation.

      Parameters:
        target
        `propertyValue` - The property value to validate
        `errors` - The errors instance to record errors against