When a bean-level constraint fails, this is the object that you get when calling javax.validation.InvalidConstraint#getValue()
When a property-level constraint fails, the JSR303 API currently does not give you access to the (child) object to which the propertyPath leads.
In the reference implementation (
http://code.google.com/p/agimatec-validation/), you can access it with some extensions:
1. Create a subclass of com.agimatec.utility.validation.jsr303.InvalidConstraintImpl and add a property to hold the object
2. create a subclass of com.agimatec.utility.validation.jsr303.ConstraintValidationListener.
Method addError() gets a ValidationContext. The ValidationContext has a method getBean(), which is the object you need. Put it into the subclass of InvalidConstraintImpl
2. Subclass com.agimatec.utility.validation.jsr303.ClassValidator and overwrite method createContext(). Instanciate your subclass of ConstraintValidationListener there.
------------------
alternatively you can use BeanValidator instead of ClassValidator. Validation returns com.agimatec.utility.validation.ValidationResults instead of a Set of InvalidContraints. The API ValidationResults offers errors-by-reason and errors-by-owner. Error instances hold the object, the reason and the propertyName.