I wanted ease of use and comfort methods when using Java’s legacy Enum. Like resolving a value by its case-insensitive name or ordinal. Or easily, flexibly, and quickly, pretty-printing (a subset of) the Enum’s values, again by name and/or ordinal.
As old as Java’s Enum is, I think it’s absolutely fantastic. I just wanted to increase its fantastic-ness!
I wanted ease of use and comfort methods when using Java’s legacy Enum. Like resolving a value by its case-insensitive name or ordinal. Or easily, flexibly, and quickly, pretty-printing (a subset of) the Enum’s values, again by name and/or ordinal.
As old as Java’s Enum is, I think it’s absolutely fantastic. I just wanted to increase its fantastic-ness!
You can use java.lang.ClassValue to store per-(enum-)class state generically.
Meaning, instead of having to instrument each enum class, you could have
where the of() implementation uses ClassValue to store the cached data.