Say I have a type which can be an integer or an enumeration, would it be possible to do:
@NotNull @Min(0) @OneOf({Integer, MyEnum}) Object foo;
(@OneOf is an example, and gives a list of acceptable assignable types )
It looks like constraints are advised to accept null as a value to allow NotNull to work, but to fail if data is not of a type that the constraint can handle.
Are constraints meant to ignore data that is of a type that isn't accepted, or are these cases expected to be handled by custom annotations?
|