Make enum conversion case-insensitive by default
See original GitHub issueI’d like to propose to make enum
value conversion case-insensitive by default, because it’s probably more convenient for the command line user to not care about casing, and the risk to accidentally refer to another enum
value that just differs in case is rather low.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Case-insensitive matching of a string to a Java enum
To do a case-insensitive matching, one can write a custom method inside the Day enum, e.g. public static Day lookup(String day) { for...
Read more >Case insensitive enum mapping with @RequestParam
Custom case-insensitive matching. The default behaviour is caused by Spring utilizing com.sun.beans.editors.EnumEditor to map enum values mapped ...
Read more >Controlling Case Sensitivity in String Comparisons - O'Reilly
The CHAR and VARCHAR types are not case sensitive by default, but may be declared as BINARY to make them case sensitive. ENUM...
Read more >How To Serialize and Deserialize Enums with Jackson
By default, Jackson will use the Enum name to deserialize from JSON. For example, it'll deserialize the JSON: {"distance":"KILOMETER"}
Read more >Value Conversions - EF Core - Microsoft Learn
For example, enum to string conversions are used as an example above, ... perform case-insensitive string comparisons by default.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That’s a good idea. I decided to add an
ignoreCase
parameter toenum
andchoice
, with value value defaulting tofalse
forchoice
, andtrue
forenum
.Even better, thanks a lot!