Groovy Documentation

## org.codehaus.groovy.grails.validation
[Java] Class AbstractConstraint

    java.lang.Object
      org.codehaus.groovy.grails.validation.AbstractConstraint

All Implemented Interfaces:
  Constraint

    public abstract class AbstractConstraint

Abstract class for constraints to extend.

Authors:
  Graeme Rocher

Field Summary
`protected java.lang.String` | `classShortName`
`protected java.lang.Class` | `constraintOwningClass`
`protected java.lang.Object` | `constraintParameter`
`protected java.lang.String` | `constraintPropertyName`
`protected MessageSource` | `messageSource`

Method Summary
`protected void` | `checkState()`
`protected java.lang.String` | `getDefaultMessage(java.lang.String code)` Returns the default message for the given message code in the current locale.
`java.lang.String` | `getPropertyName()`
`protected void` | `processValidate(java.lang.Object target, java.lang.Object propertyValue, Errors errors)`
`void` | `rejectValue(java.lang.Object target, Errors errors, java.lang.String defaultMessageCode, Object[] args)`
`void` | `rejectValue(java.lang.Object target, Errors errors, java.lang.String defaultMessageCode, java.lang.String code, Object[] args)`
`void` | `rejectValue(java.lang.Object target, Errors errors, java.lang.String defaultMessageCode, String[] codes, Object[] args)`
`void` | `rejectValue(java.lang.Object target, Errors errors, java.lang.String code, java.lang.String defaultMessage)`
`void` | `rejectValue(java.lang.Object target, Errors errors, java.lang.String code, Object[] args, java.lang.String defaultMessage)`
`void` | `rejectValueWithDefaultMessage(java.lang.Object target, Errors errors, java.lang.String defaultMessage, String[] codes, Object[] args)`
`void` | `setMessageSource(MessageSource source)`
`void` | `setOwningClass(java.lang.Class constraintOwningClass)` {@inheritDoc}
`void` | `setParameter(java.lang.Object constraintParameter)` @param constraintParameter The constraintParameter to set.
`void` | `setPropertyName(java.lang.String constraintPropertyName)` @param constraintPropertyName The constraintPropertyName to set.
`protected boolean` | `skipBlankValues()`
`protected boolean` | `skipNullValues()`
`java.lang.String` | `toString()`
`void` | `validate(java.lang.Object target, java.lang.Object propertyValue, Errors errors)`

Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), 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()

Field Detail

### classShortName

    protected java.lang.String classShortName

### constraintOwningClass

    protected java.lang.Class constraintOwningClass

### constraintParameter

    protected java.lang.Object constraintParameter

### constraintPropertyName

    protected java.lang.String constraintPropertyName

### messageSource

    protected MessageSource messageSource

Method Detail

### checkState

    protected void checkState()

### getDefaultMessage

    protected java.lang.String getDefaultMessage(java.lang.String code)

  Returns the default message for the given message code in the current locale. Note that the string returned includes any placeholders that the required message has - these must be expanded by the caller if required.
  Parameters:
    `code` - The i18n message code to look up.
  Returns:
    The message corresponding to the given code in the current locale.

### getPropertyName

    public java.lang.String getPropertyName()

### processValidate

    protected void processValidate(java.lang.Object target, java.lang.Object propertyValue, Errors errors)

### rejectValue

    public void rejectValue(java.lang.Object target, Errors errors, java.lang.String defaultMessageCode, Object[] args)

### rejectValue

    public void rejectValue(java.lang.Object target, Errors errors, java.lang.String defaultMessageCode, java.lang.String code, Object[] args)

### rejectValue

    public void rejectValue(java.lang.Object target, Errors errors, java.lang.String defaultMessageCode, String[] codes, Object[] args)

### rejectValue

    public void rejectValue(java.lang.Object target, Errors errors, java.lang.String code, java.lang.String defaultMessage)

### rejectValue

    public void rejectValue(java.lang.Object target, Errors errors, java.lang.String code, Object[] args, java.lang.String defaultMessage)

### rejectValueWithDefaultMessage

    public void rejectValueWithDefaultMessage(java.lang.Object target, Errors errors, java.lang.String defaultMessage, String[] codes, Object[] args)

### setMessageSource

    public void setMessageSource(MessageSource source)

### setOwningClass

    @SuppressWarnings("rawtypes")
    public void setOwningClass(java.lang.Class constraintOwningClass)

  {@inheritDoc}
  See Also:
    Constraint.setOwningClass

### setParameter

    public void setParameter(java.lang.Object constraintParameter)

  Parameters:
    `constraintParameter` - The constraintParameter to set.

### setPropertyName

    public void setPropertyName(java.lang.String constraintPropertyName)

  Parameters:
    `constraintPropertyName` - The constraintPropertyName to set.

### skipBlankValues

    protected boolean skipBlankValues()

### skipNullValues

    protected boolean skipNullValues()

### toString

    @Override
    public java.lang.String toString()

### validate

    public void validate(java.lang.Object target, java.lang.Object propertyValue, Errors errors)

Groovy Documentation