I have some simple enums like below.
public enum Status {
ACTIVE,
PASSIVE;
private Status() {
}
}
I have a String status field in my REST service input object.
It converts it to PASSIVE when the service receives both requests.
CASE 1 status = 1
{
"name": "Walter",
"surname": "White"
"status": "1"
}
CASE 2 status = "PASSIVE"
{
"name": "Walter",
"surname": "White"
"status": "PASSIVE"
}
I do not want the default convertor accepts the numeric inputs (CASE 1). I mean I do not want it to convert 1 to PASSIVE by using the index of the enum.
I want it only accepts Non numeric values as it is in CASE 2.
Also consider that I have many enums like this and I want to apply the restriction to all my enums.
How can I make it works as I explained above ?