org.codehaus.groovy.grails.validation
Class AbstractConstraint
java.lang.Object
org.codehaus.groovy.grails.validation.AbstractConstraint
- All Implemented Interfaces:
- Constraint
- Direct Known Subclasses:
- AbstractPersistentConstraint, BlankConstraint, CreditCardConstraint, EmailConstraint, InListConstraint, MatchesConstraint, MaxConstraint, MaxSizeConstraint, MinConstraint, MinSizeConstraint, NotEqualConstraint, NullableConstraint, RangeConstraint, ScaleConstraint, SizeConstraint, UrlConstraint, ValidatorConstraint
public abstract class AbstractConstraint
- extends Object
- implements Constraint
- Author:
- Graeme Rocher
Abstract class for constraints to implement
|
Method Summary |
protected String |
getDefaultMessage(String code,
Object[] args)
|
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 |
skipEmptyStrings()
|
protected boolean |
skipNullValues()
|
String |
toString()
|
void |
validate(Object target,
Object propertyValue,
Errors errors)
Validate this constraint against a property value |
constraintPropertyName
protected String constraintPropertyName
constraintOwningClass
protected Class constraintOwningClass
constraintParameter
protected Object constraintParameter
classShortName
protected String classShortName
messageSource
protected MessageSource messageSource
AbstractConstraint
public AbstractConstraint()
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.
validate
public void validate(Object target,
Object propertyValue,
Errors errors)
- Description copied from interface:
Constraint
- Validate this constraint against a property value
- Specified by:
validate in interface Constraint
propertyValue - The property value to validateerrors - The errors instance to record errors against
skipNullValues
protected boolean skipNullValues()
skipEmptyStrings
protected boolean skipEmptyStrings()
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,
Object[] args)
processValidate
protected abstract void processValidate(Object target,
Object propertyValue,
Errors errors)
toString
public String toString()
- Overrides:
toString in class Object
Copyright (c) 2005-2006 The Grails project