Uploaded image for project: 'MyFaces Trinidad'
  1. MyFaces Trinidad
  2. TRINIDAD-2215

String -> Accessibility enum API

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.0-core
    • 2.0.1-core
    • None
    • None

    Description

      The RequestContext.Accessibility enum defines aliases/pretty names for the enum constants:

      public enum Accessibility
      {
      /**

      • Output supports accessibility features
        */
        DEFAULT("default"),

      /**

      • Accessibility-specific constructs are stripped out to optimize output size
        */
        INACCESSIBLE("inaccessible"),

      /**

      • Accessibility-specific constructs are added to improve behavior under a screen reader
      • (but may affect other users negatively)
        */
        SCREEN_READER("screenReader");

      Accessibility(String name)

      { _name = name; }

      @Override
      public String toString()

      { return _name; }

      private final String _name;
      };

      I have several places in my code where I need to translate from the pretty name/alias (eg. "screenReader"), back to the corresponding enum constant.

      Enum.valueOf() is useless for this, since this only honors the canonical enum constant names (eg. "SCREEN_READER").

      I would like an API that performs the equivalent functionality of Enum.valueOf(), but for the pretty names/aliases.

      Attachments

        1. trinidad-2215-take2.patch
          4 kB
          Andy Schwartz
        2. trinidad-2215.patch
          3 kB
          Andy Schwartz

        Activity

          People

            andy.schwartz Andy Schwartz
            andy.schwartz Andy Schwartz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: