public class EnumConverter extends Object implements javax.faces.convert.Converter, Serializable
Enum that are backed by a properties file.
Enum to an actual Enum and vice versa.
As expected, this converter can only do its work reliably when the localized description is unique (case insensitive) within
the enumerated set.<h:outputText value="#{car.carDetail.color}" converter="enumConverter}"/>| Constructor and Description |
|---|
EnumConverter() |
| Modifier and Type | Method and Description |
|---|---|
Object |
getAsObject(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component,
String stringEnum)
Converts the supplied stringEnum to an object of type
Enum. |
String |
getAsString(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component,
Object enumeratedValue)
Converts the supplied enumeratedValue to a localized String consisting of the localized description of the enumerated
value.
|
public Object getAsObject(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, String stringEnum)
Enum.getAsObject in interface javax.faces.convert.ConverterfacesContext - Faces Context.component - The UI component that stores the enumerated value.stringEnum - The enum in String format to convert to an Enum.Enum or null when no enumerated value with the supplied
stringEnum exists.public String getAsString(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, Object enumeratedValue)
getAsString in interface javax.faces.convert.ConverterfacesContext - Faces Context.component - The UI component that stores the enumerated value.enumeratedValue - The enum to convert to a localized String.Enum.Copyright © 2008–2018. All rights reserved.