|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.codehaus.groovy.grails.validation.GrailsDomainClassValidator
public class GrailsDomainClassValidator
A specialised Spring validator that validates a domain class instance using the constraints defined in the static constraints closure.
Constructor Summary | |
---|---|
GrailsDomainClassValidator()
|
Method Summary | |
---|---|
protected void |
cascadeToAssociativeProperty(Errors errors,
BeanWrapper bean,
GrailsDomainClassProperty persistentProperty)
Cascades validation onto an associative property maybe a one-to-many, one-to-one or many-to-one relationship |
protected void |
cascadeValidationToMany(Errors errors,
BeanWrapper bean,
GrailsDomainClassProperty persistentProperty,
String propertyName)
Cascades validation to a one-to-many type relationship. |
protected void |
cascadeValidationToOne(Errors errors,
BeanWrapper bean,
Object associatedObject,
GrailsDomainClassProperty persistentProperty,
String propertyName)
Cascades validation to a one-to-one or many-to-one property |
GrailsDomainClass |
getDomainClass()
|
void |
setDomainClass(GrailsDomainClass domainClass)
|
void |
setMessageSource(MessageSource messageSource)
|
boolean |
supports(Class clazz)
|
void |
validate(Object obj,
Errors errors)
|
void |
validate(Object obj,
Errors errors,
boolean cascade)
An extended version of the validate(errors,obj) method that takes an additional argument specifying whether the Validator should cascade into associations or not |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GrailsDomainClassValidator()
Method Detail |
---|
public boolean supports(Class clazz)
supports
in interface Validator
public void setDomainClass(GrailsDomainClass domainClass)
domainClass
- The domainClass to set.public GrailsDomainClass getDomainClass()
public void setMessageSource(MessageSource messageSource)
messageSource
- The messageSource to set.public void validate(Object obj, Errors errors, boolean cascade)
CascadingValidator
validate
in interface CascadingValidator
obj
- The Object to validateerrors
- The Spring Errors instancecascade
- True if validation should cascade into associationsCascadingValidator.validate(Object, org.springframework.validation.Errors, boolean)
public void validate(Object obj, Errors errors)
validate
in interface Validator
Validator.validate(Object, org.springframework.validation.Errors)
protected void cascadeToAssociativeProperty(Errors errors, BeanWrapper bean, GrailsDomainClassProperty persistentProperty)
errors
- The Errors instnacebean
- The original beanpersistentProperty
- The associative propertyprotected void cascadeValidationToMany(Errors errors, BeanWrapper bean, GrailsDomainClassProperty persistentProperty, String propertyName)
errors
- The Errors instancebean
- The original BeanWrapperpersistentProperty
- An association whose isOneToMeny() method returns truepropertyName
- The name of the propertyprotected void cascadeValidationToOne(Errors errors, BeanWrapper bean, Object associatedObject, GrailsDomainClassProperty persistentProperty, String propertyName)
errors
- The Errors instancebean
- The original BeanWrapperassociatedObject
- The associated object's current valuepersistentProperty
- The GrailsDomainClassProperty instancepropertyName
- The name of the property
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |