No that's not possible in Bean Validation (which is the specification Hibernate Validator is the reference implementation for). You have to explicitly specify all constraints, either via annotations or via xml configuration. I guess you could write a custom class validator which checks for date instances in the class (via reflection) and validates them. Note, I don't recommend this!
What you are asking for is some sort of aspect type of language to apply constraints. I personally think this could get quite ugly, but you could suggest this feature on the BVAL forum or jira.
--Hardy
|