Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.0.0-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()
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.