org.codehaus.groovy.grails.orm.hibernate.validation
Class HibernateDomainClassValidator
java.lang.Object
org.codehaus.groovy.grails.validation.GrailsDomainClassValidator
org.codehaus.groovy.grails.orm.hibernate.validation.HibernateDomainClassValidator
- All Implemented Interfaces:
- GrailsApplicationAware, CascadingValidator, ApplicationContextAware, Validator
public class HibernateDomainClassValidator
- extends GrailsDomainClassValidator
- implements ApplicationContextAware
A validator that first checks if the Hibernate PersistentCollection instance has been initialised before bothering
to cascade
- Since:
- 0.5
Created: Apr 13, 2007
Time: 6:32:08 PM
- Author:
- Graeme Rocher
Method Summary |
protected void |
cascadeValidationToMany(Errors errors,
BeanWrapper bean,
GrailsDomainClassProperty persistentProperty,
String propertyName)
Overrides the default behaviour and first checks if a PersistentCollection instance has been initialised using the
wasInitialised() method before cascading |
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 |
protected GrailsDomainClass |
getAssociatedDomainClassFromApplication(Object associatedObject)
|
protected void |
postValidate(Object obj,
Errors errors)
Subclasses can overrite to provide custom handling of the errors object post validation |
void |
setApplicationContext(ApplicationContext applicationContext)
|
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 |
HibernateDomainClassValidator
public HibernateDomainClassValidator()
getAssociatedDomainClassFromApplication
protected GrailsDomainClass getAssociatedDomainClassFromApplication(Object associatedObject)
- Overrides:
getAssociatedDomainClassFromApplication
in class GrailsDomainClassValidator
validate
public void validate(Object obj,
Errors errors,
boolean cascade)
- Description copied from interface:
CascadingValidator
- An extended version of the validate(errors,obj) method that takes an additional argument specifying whether
the Validator should cascade into associations or not
- Specified by:
validate
in interface CascadingValidator
- Overrides:
validate
in class GrailsDomainClassValidator
- Parameters:
obj
- The Object to validateerrors
- The Spring Errors instancecascade
- True if validation should cascade into associations- See Also:
CascadingValidator.validate(Object, org.springframework.validation.Errors, boolean)
cascadeValidationToMany
protected void cascadeValidationToMany(Errors errors,
BeanWrapper bean,
GrailsDomainClassProperty persistentProperty,
String propertyName)
- Overrides the default behaviour and first checks if a PersistentCollection instance has been initialised using the
wasInitialised() method before cascading
- Overrides:
cascadeValidationToMany
in class GrailsDomainClassValidator
- Parameters:
errors
- The Spring Errors instancebean
- The BeanWrapper for the beanpersistentProperty
- The GrailsDomainClassProperty instancepropertyName
- The name of the property- See Also:
PersistentCollection.wasInitialized()
cascadeValidationToOne
protected void cascadeValidationToOne(Errors errors,
BeanWrapper bean,
Object associatedObject,
GrailsDomainClassProperty persistentProperty,
String propertyName)
- Description copied from class:
GrailsDomainClassValidator
- Cascades validation to a one-to-one or many-to-one property
- Overrides:
cascadeValidationToOne
in class GrailsDomainClassValidator
- Parameters:
errors
- The Errors instancebean
- The original BeanWrapperassociatedObject
- The associated object's current valuepersistentProperty
- The GrailsDomainClassProperty instancepropertyName
- The name of the property
postValidate
protected void postValidate(Object obj,
Errors errors)
- Description copied from class:
GrailsDomainClassValidator
- Subclasses can overrite to provide custom handling of the errors object post validation
- Overrides:
postValidate
in class GrailsDomainClassValidator
- Parameters:
obj
- The object to validateerrors
- The Errors object
setApplicationContext
public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException
- Specified by:
setApplicationContext
in interface ApplicationContextAware
- Throws:
BeansException
Copyright (c) 2005-2009 The Grails project