I would like to use a class level annotation constraint. However I cannot get the inner constraints to validate automatically. I'd like to help with one part, to incorporate validation groups into this technique.
@ConstraintA({
@ConstraintB(stuff),
@ConstraintB(stuff, groups=SomeGroup.class)
})
public class Form{
}
I currentily trigger the constraints like so.
if(constraint instanceof ConstraintB){
new ConstraintBValidator().isValid(target, context);
}
However this sucks obviously.I will eventually refactor to trigger the isValid methods through a call to the AnnotationInvocationHandler.invoke() method, but im a little way from that still.
My issue is that all ConstraintB instances are passed into my ConstraintA. I wish only the ones with the appropriate groups to be passed to ConstraintA. I doubt this ability exists, so how can i identify which groups need to be triggered and which dont?
I dont see in my debug, any objects which specify which groups should be triggered?
Any ideas?