2 comments

  • jimofl 2 hours ago

    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!

      layer8 2 hours ago

      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

          MyEnumHelper.of(AnyEnum.class)
              .whateverFunctionalityYouWant()
      
      where the of() implementation uses ClassValue to store the cached data.