You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Andy Schwartz (Commented) (JIRA)" <de...@myfaces.apache.org> on 2012/02/14 04:19:20 UTC

[jira] [Commented] (TRINIDAD-2215) String -> Accessibility enum API

    [ https://issues.apache.org/jira/browse/TRINIDAD-2215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13207482#comment-13207482 ] 

Andy Schwartz commented on TRINIDAD-2215:
-----------------------------------------

The attached patch file:

https://issues.apache.org/jira/secure/attachment/12514439/trinidad-2215.patch

Adds a public static valueOfAlias() method to the the RequestContext.Accessibility API. 
                
> String -> Accessibility enum API
> --------------------------------
>
>                 Key: TRINIDAD-2215
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2215
>             Project: MyFaces Trinidad
>          Issue Type: Improvement
>    Affects Versions: 2.0.0-core
>            Reporter: Andy Schwartz
>            Assignee: Andy Schwartz
>            Priority: Minor
>         Attachments: trinidad-2215.patch
>
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira