|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.codehaus.groovy.grails.validation.GrailsDomainClassValidator
public class GrailsDomainClassValidator extends java.lang.Object
A specialised Spring validator that validates a domain class instance using the constraints defined in the static constraints closure.
| Field Summary | |
|---|---|
protected GrailsDomainClass |
domainClass
|
protected GrailsApplication |
grailsApplication
|
protected org.springframework.context.MessageSource |
messageSource
|
protected java.lang.Class |
targetClass
|
| Method Summary | |
|---|---|
protected void
|
cascadeToAssociativeProperty(org.springframework.validation.Errors errors, org.springframework.beans.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(org.springframework.validation.Errors errors, org.springframework.beans.BeanWrapper bean, GrailsDomainClassProperty persistentProperty, java.lang.String propertyName)
Cascades validation to a one-to-many type relationship. |
protected void
|
cascadeValidationToOne(org.springframework.validation.Errors errors, org.springframework.beans.BeanWrapper bean, java.lang.Object associatedObject, GrailsDomainClassProperty persistentProperty, java.lang.String propertyName, java.lang.Object indexOrKey)
Cascades validation to a one-to-one or many-to-one property. |
protected GrailsDomainClass
|
getAssociatedDomainClassFromApplication(java.lang.Object associatedObject)
|
GrailsDomainClass
|
getDomainClass()
@param messageSource The messageSource to set. |
protected void
|
postValidate(java.lang.Object obj, org.springframework.validation.Errors errors)
Subclasses can overrite to provide custom handling of the errors object post validation. |
void
|
setDomainClass(GrailsDomainClass domainClass)
@param domainClass The domainClass to set. |
void
|
setGrailsApplication(GrailsApplication grailsApplication)
|
void
|
setMessageSource(org.springframework.context.MessageSource messageSource)
|
boolean
|
supports(java.lang.Class clazz)
|
void
|
validate(java.lang.Object obj, org.springframework.validation.Errors errors, boolean cascade)
@see org.codehaus.groovy.grails.validation.CascadingValidator#validate(Object, org.springframework.validation.Errors, boolean) |
void
|
validate(java.lang.Object obj, org.springframework.validation.Errors errors)
@see org.springframework.validation.Validator#validate(Object, org.springframework.validation.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 |
|---|
protected GrailsDomainClass domainClass
protected GrailsApplication grailsApplication
protected org.springframework.context.MessageSource messageSource
protected java.lang.Class targetClass
| Method Detail |
|---|
protected void cascadeToAssociativeProperty(org.springframework.validation.Errors errors, org.springframework.beans.BeanWrapper bean, GrailsDomainClassProperty persistentProperty)
errors - The Errors instnacebean - The original beanpersistentProperty - The associative property
@java.lang.SuppressWarningsObject collection = bean.getPropertyValue(propertyName); protected void cascadeValidationToMany(org.springframework.validation.Errors errors, org.springframework.beans.BeanWrapper bean, GrailsDomainClassProperty persistentProperty, java.lang.String propertyName)
errors - The Errors instancebean - The original BeanWrapperpersistentProperty - An association whose isOneToMeny() method returns truepropertyName - The name of the property
@java.lang.SuppressWarningsif (associatedObject == null) {
protected void cascadeValidationToOne(org.springframework.validation.Errors errors, org.springframework.beans.BeanWrapper bean, java.lang.Object associatedObject, GrailsDomainClassProperty persistentProperty, java.lang.String propertyName, java.lang.Object indexOrKey)
errors - The Errors instancebean - The original BeanWrapperassociatedObject - The associated object's current valuepersistentProperty - The GrailsDomainClassProperty instancepropertyName - The name of the property
protected GrailsDomainClass getAssociatedDomainClassFromApplication(java.lang.Object associatedObject)
public GrailsDomainClass getDomainClass()
messageSource - The messageSource to set.
protected void postValidate(java.lang.Object obj, org.springframework.validation.Errors errors)
obj - The object to validateerrors - The Errors object
public void setDomainClass(GrailsDomainClass domainClass)
domainClass - The domainClass to set.
public void setGrailsApplication(GrailsApplication grailsApplication)
public void setMessageSource(org.springframework.context.MessageSource messageSource)
@java.lang.SuppressWarnings("rawtypes")
public boolean supports(java.lang.Class clazz)
@java.lang.SuppressWarnings({ "unchecked", "rawtypes" })
public void validate(java.lang.Object obj, org.springframework.validation.Errors errors, boolean cascade)
public void validate(java.lang.Object obj, org.springframework.validation.Errors errors)
Groovy Documentation