|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.bval.BeanValidator<T>
public class BeanValidator<T extends ValidationListener>
Description: Top-Level API-class to validate objects or object-trees. You can invoke, extend or utilize this class if you need other ways to integrate validation in your application.
This class supports cyclic object graphs by keeping track of validated instances in the validation context.
Constructor Summary | |
---|---|
BeanValidator()
Create a new BeanValidator instance. |
|
BeanValidator(MetaBeanFinder metaBeanFinder)
Create a new BeanValidator instance. |
Method Summary | ||
---|---|---|
protected ValidationContext<T> |
createContext()
factory method - overwrite in subclasses |
|
protected T |
createResults()
factory method - overwrite in subclasses |
|
protected
|
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
|
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
|
validateRelatedBean(ValidationContext<VL> context,
MetaProperty prop)
Validate a property of a graph. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BeanValidator()
public BeanValidator(MetaBeanFinder metaBeanFinder)
metaBeanFinder
- Method Detail |
---|
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 method
Validate
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 property
protected <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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |