Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.validation
Class AbstractConstraint

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

All Implemented Interfaces:
  Constraint

Direct Known Subclasses:
  AbstractPersistentConstraint, AbstractVetoingConstraint, CreditCardConstraint, EmailConstraint, InListConstraint, MatchesConstraint, MaxConstraint, MaxSizeConstraint, MinConstraint, MinSizeConstraint, NotEqualConstraint, RangeConstraint, ScaleConstraint, SizeConstraint, UrlConstraint, ValidatorConstraint

    public abstract class AbstractConstraint

extends Object
implements Constraint

Author:
  Graeme Rocher Abstract class for constraints to implement

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

Constructor Summary
`AbstractConstraint()`

Method Summary
`protected void` | `checkState()`
`protected String` | `getDefaultMessage(String code)` Returns the default message for the given message code in the current locale.
`String` | `getPropertyName()`
`protected abstract void` | `processValidate(Object target, Object propertyValue, Errors errors)`
`void` | `rejectValue(Object target, Errors errors, String defaultMessageCode, Object[] args)`
`void` | `rejectValue(Object target, Errors errors, String code, Object[] args, String defaultMessage)`
`void` | `rejectValue(Object target, Errors errors, String code, String defaultMessage)`
`void` | `rejectValue(Object target, Errors errors, String defaultMessageCode, String[] codes, Object[] args)`
`void` | `rejectValue(Object target, Errors errors, String defaultMessageCode, String code, Object[] args)`
`void` | `rejectValueWithDefaultMessage(Object target, Errors errors, String defaultMessage, String[] codes, Object[] args)`
`void` | `setMessageSource(MessageSource source)` The message source to evaluate the default messages from
`void` | `setOwningClass(Class constraintOwningClass)` The class the constraint applies to
`void` | `setParameter(Object constraintParameter)` The parameter which the constraint is validated against
`void` | `setPropertyName(String constraintPropertyName)` The name of the property the constraint applies to
`protected boolean` | `skipNullValues()`
`String` | `toString()`
`void` | `validate(Object target, Object propertyValue, Errors errors)` Validate this constraint against a property value.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.codehaus.groovy.grails.validation.Constraint
`getName, supports`

Field Detail

### constraintPropertyName

    protected String constraintPropertyName

### constraintOwningClass

    protected Class constraintOwningClass

### constraintParameter

    protected Object constraintParameter

### classShortName

    protected String classShortName

### messageSource

    protected MessageSource messageSource

Constructor Detail

### AbstractConstraint

    public AbstractConstraint()

Method Detail

### setMessageSource

    public void setMessageSource(MessageSource source)

  Description copied from interface: `Constraint`
  The message source to evaluate the default messages from

  Specified by:
    `setMessageSource` in interface `Constraint`

### getPropertyName

    public String getPropertyName()

  Specified by:
    `getPropertyName` in interface `Constraint`
  Returns:
    The property name of the constraint

### setOwningClass

    public void setOwningClass(Class constraintOwningClass)

  Description copied from interface: `Constraint`
  The class the constraint applies to

  Specified by:
    `setOwningClass` in interface `Constraint`
  Parameters:
    `constraintOwningClass` - The constraintOwningClass to set.

### setPropertyName

    public void setPropertyName(String constraintPropertyName)

  Description copied from interface: `Constraint`
  The name of the property the constraint applies to

  Specified by:
    `setPropertyName` in interface `Constraint`
  Parameters:
    `constraintPropertyName` - The constraintPropertyName to set.

### setParameter

    public void setParameter(Object constraintParameter)

  Description copied from interface: `Constraint`
  The parameter which the constraint is validated against

  Specified by:
    `setParameter` in interface `Constraint`
  Parameters:
    `constraintParameter` - The constraintParameter to set.

### checkState

    protected void checkState()

### validate

    public void validate(Object target,
                         Object propertyValue,
                         Errors errors)

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

  Specified by:
    `validate` in interface `Constraint`
    `propertyValue` - The property value to validate
    `errors` - The errors instance to record errors against

### skipNullValues

    protected boolean skipNullValues()

### rejectValue

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

### rejectValue

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

### rejectValue

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

### rejectValueWithDefaultMessage

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

### rejectValue

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

### rejectValue

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

### getDefaultMessage

    protected String getDefaultMessage(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.

### processValidate

    protected abstract void processValidate(Object target,
                                            Object propertyValue,
                                            Errors errors)

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2005-2006 The Grails project