hi Emmanuel =)
Okay, @MyValidation1 was then a Bean Validator. In that case we would have to work to create the custom validators for each case.......
I will make some basic questions to try to better understand the solution you are proposing:
1) the Hibernate already has support for Bean Validators? (I don't remember to have seen it). I think that does not yet exist, right?
2) There dependence between the @MyValidation1 and the Bean? How @MyValidation1 would have access to attributes of the Bean? Using the dependency or reflection?
3) If I change the Bean, I have to also change the @MyValidation1?
4) @MyValidation1 would replace the Validators of the fields (NotNull, Length, Mastercard) or would enable / disable these validations?
5) If @MyValidation1 replace the validation of fields, I would have to rewrite the rules of the @Length, @Credicard, ... again in the @MyValidation1?
6) If @MyValidation1 not replace the validation of fields, as I do for him enabling a single validation (@NotNull) and not enable another validation (@Length)?
applyIf only solves a subset of the "dependency between validation rules" problem
What problem the applyIf not solve?
You remember an example?
If there are any, we can try to improve the idea together.