Class BeanValidator
- java.lang.Object
-
- net.sourceforge.jbizmo.commons.validation.BeanValidator
-
public class BeanValidator extends Object
This class provides validation services within the constraint framework
Copyright 2010 (C) by Martin Ganserer
- Version:
- 1.0.0
- Author:
- Martin Ganserer
-
-
Constructor Summary
Constructors Constructor Description BeanValidator(Object validationTarget)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static List<ConstraintViolation>checkConstraints(Object value, Set<Annotation> annotations)Check the constraintsConstrainedClassgetConstrainedClass()voidvalidate()Validate the objectList<ConstraintViolation>validateProperty(ConstrainedClass constrainedClass, String propertyName, Object value)Checks if the value is valid
-
-
-
Constructor Detail
-
BeanValidator
public BeanValidator(Object validationTarget)
Constructor- Parameters:
validationTarget-- Throws:
IllegalArgumentException- if the validationTarget is null
-
-
Method Detail
-
getConstrainedClass
public ConstrainedClass getConstrainedClass()
- Returns:
- the
ConstrainedClassthat provides access to the property constraints for this class
-
validate
public void validate()
Validate the object- Throws:
PropertyConstraintViolationException- if the validation of a property value has failed
-
validateProperty
public List<ConstraintViolation> validateProperty(ConstrainedClass constrainedClass, String propertyName, Object value) throws IntrospectionException
Checks if the value is valid- Parameters:
constrainedClass-propertyName-value-- Returns:
- a list of constraint violations
- Throws:
IntrospectionException- if there are problems accessing the property
-
checkConstraints
public static List<ConstraintViolation> checkConstraints(Object value, Set<Annotation> annotations)
Check the constraints- Parameters:
value- the value to be checkedannotations-- Returns:
- a list of constraint violations
-
-