So, I'm fairly familiar with JSR-303 and have used GWT-Validations. I'm now looking into using the latest Hibernate Validator...
I have these very dumb DTO's, that I eventually want to validate.
Is there an idiom for hiding the annotation based validation of said DTO's from a client user? We're not trying to be secret, we're just trying not to confuse novice (or novice to Java)users, and we plan to document most validation at the API/Java doc level.
Would it be possible to define the DTO without annotations, then define a ValidatableDTO subclass that exists only on the app tier(and would be easy to copy values from the regularDTO and the Validatable one), and put the annotations on the getters(thus overriding the getter with the exact same implementation)?
Note that I prefer not to use the XML validation descriptors.
I figure either: a) I'm trying to do something that the current design doesn't support. b) What I'm proposing(overriding getters) won't work or is too kludgy for any self respecting Java developer to advocate. c) There is a much easier way to do what I want to do... lol
Anyone have any suggestions?
|