Here's my situation,
I have a class with Enum
type fields. I want to execute annotated validation for enum
types, similar to annotations for strings, example: @Size
, @NotNull
etc.
Problem is, json
deserializer fails on enum
type before validation occurs.
public class myClass {
@JsonProperty
//@SomeCustomValidator -- ??
private EnumType enumValue;
}
public enum EnumType {
A,
B,
C
}
Few things:
- I do not want to change the data type to
String
. Tried steps in following threads, didn't fix my problem.
Tried this link, but get an error in deserialization before validation hits