I have a generic super class which I'd like to validate:
abstract class Generic<T> {
// ... other validated fields
private T value;
}
Then I have several concrete classes and for each of it I'd like to appy specific validations on a value field.
E.g. for the below class I'd like to ensure that the value field is not less than 0.
class ConcreteInt<Integer> {
// @Min(0)
}
Another example, for the below class I'd like to ensure that the value is not blank.
class ConcreteString<String> {
// @NotBlank
}
Where should I put my validation annotations on a concrete classes to make them work?