public class BeanValidator<T extends ValidationListener> extends Object
Constructor and Description |
---|
BeanValidator()
Create a new BeanValidator instance.
|
BeanValidator(MetaBeanFinder metaBeanFinder)
Create a new BeanValidator instance.
|
Modifier and Type | Method and Description |
---|---|
protected ValidationContext<T> |
createContext()
factory method - overwrite in subclasses
|
protected T |
createResults()
factory method - overwrite in subclasses
|
protected <VL extends ValidationListener> |
determineMetaBean(Validate validate,
Object parameter,
ValidationContext<VL> context)
Determine the metabean for the given object.
|
MetaBeanFinder |
getMetaBeanFinder()
Get the metabean finder associated with this validator.
|
boolean |
isTreatMapsLikeBeans() |
void |
setTreatMapsLikeBeans(boolean treatMapsLikeBeans) |
T |
validate(Object bean)
Convenience API.
|
T |
validate(Object bean,
MetaBean metaBean)
Convenience API.
|
protected <VL extends ValidationListener> |
validateBeanNet(ValidationContext<VL> context)
internal validate a bean (=not a collection of beans) and
its related beans
|
T |
validateCall(Method method,
Object[] parameters)
Validate the method parameters based on @Validate annotations.
|
T |
validateProperty(Object bean,
MetaProperty metaProperty)
Convenience API.
|
protected <VL extends ValidationListener> |
validateRelatedBean(ValidationContext<VL> context,
MetaProperty prop)
Validate a property of a graph.
|
public BeanValidator()
public BeanValidator(MetaBeanFinder metaBeanFinder)
metaBeanFinder
- public T validate(Object bean)
bean
- public T validate(Object bean, MetaBean metaBean)
bean
- - a single bean or a collection of beans (that share the same
metaBean!)metaBean
- public T validateCall(Method method, Object[] parameters)
method
- - a methodparameters
- - the parameters suitable to the methodValidate
protected <VL extends ValidationListener> boolean determineMetaBean(Validate validate, Object parameter, ValidationContext<VL> context)
VL
- validate
- parameter
- context
- protected T createResults()
protected ValidationContext<T> createContext()
public T validateProperty(Object bean, MetaProperty metaProperty)
bean
- - the root objectmetaProperty
- - metadata for the propertyprotected <VL extends ValidationListener> void validateBeanNet(ValidationContext<VL> context)
protected <VL extends ValidationListener> void validateRelatedBean(ValidationContext<VL> context, MetaProperty prop)
VL
- context
- prop
- public boolean isTreatMapsLikeBeans()
public void setTreatMapsLikeBeans(boolean treatMapsLikeBeans)
public MetaBeanFinder getMetaBeanFinder()
MetaBeanManagerFactory.getFinder()
Copyright © 2010-2012 Apache Software Foundation. All Rights Reserved.