It's really promising the direction of JSR-303, so i'm hard to find some implementation that the people can play, so i see for now a user posted:
http://code.google.com/p/agimatec-validation/
that have a preliminary implementation, so will be great that a public read only repository will be available to people testing and discussing the JSR proposal.
I point here so i think its a better place a API change to better interoperability of implementation, discussed deeper in
http://forum.hibernate.org/viewtopic.php?t=985983:
Split the Constraint interface into:
Code:
public interface Constraint {
/**
* does the object/element pass the constraints
*/
public boolean isValid(Object value);
}
Code:
public interface InitializedConstraint<A extends Annotation> {
/**
* Take the annotations values
*
* @param parameters
*/
public void initialize(A parameters);
}
This will make more simple Constraints implementations, constraints with initialization also implements InitializedConstraint so it can be initializad in a per instance basis.
NOTE: Could be great if a standard codding guide for constraints exists, include that constraints that implements InitializedConstraint implement setter/getter for parameters (Not needed in bean annotated but improve interoperability to use the constraint stand-alone).
With this considerations the use of the Constraints implementations in scenarios that not annotated bean exists at all, can be straightforward, so all constraints are treated as same: isValid(Object value), and some settter/getter if any to set parameters of the Constraint instance.
Really good work on this JSR :)
Regards.