Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1639

Find enum using a predicate

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Won't Do
    • None
    • None
    • lang.enums.*
    • None

    Description

      `EnumUtils` supports finding an enum based on its name. However in my experience it's often required to find an enum mapped by another value related to the enum. To use a very simple example: Mapping a string input to an enum, where the string does not match the enum name.

      I propose adding a `getEnumByPredicate` method, that returns the first found enum value matching a given predicate. Could also be expanded to return a list of all matching values.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              boni Bernhard Bonigl
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h
                  1h