I have the following situation in a Spring project: we have a bunch of user forms and they need to be validated only on demand. For example, let's say I have a class SomeUserData
class SomeUserData {
//@NotNull
private String firstName;
//@NotNull
//@Min(18)
//@Max(100)
private Integer age;
}
I need to be able to save any data the user enters, even if he leaves a name empty or puts 15 for age without generating any warnings.
But I do need to run data through validation when the user requests such validation.
Does anybody know a way to solve this issue? Let me know if I haven't provided enough details.