How can I obtain the enum corresponding value from a given String
in camel case format? For instance, for the following enum:
public enum Status {
NEVER_DONE, DONE
}
and this controller:
public interface QuestionsController {
@GetMapping(value = "/questions", produces = MediaType.APPLICATION_JSON_VALUE)
List<Question> getQuestions(@RequestParam String status);
}
How could I map the received String
to the corresponding value from Status
so these requirements are met:
NEVER_DONE
andneverDone
map toNEVER_DONE
.DONE
anddone
map toDONE
.