- java.lang.Object
- 
- org.omnifaces.converter.ListIndexConverter
 
- 
 public class ListIndexConverter extends Object implements Converter<Object> The omnifaces.ListIndexConverteris a variant of theListConverterwhich automatically converts based on the position (index) of the selected item in the list instead of theObject.toString()of the selected item.UsageThis converter is available by converter ID omnifaces.ListIndexConverterand should be used in combination with<o:converter>in order to be able to pass theListsource to it, which it can use for conversion. Here's a basic usage example with PrimeFaces<p:pickList>, which is one of the few select components which doesn't useSelectItems as the source, but work directly via aList.<p:pickList value="#{bean.dualListModel}" var="entity" itemValue="#{entity}" itemLabel="#{entity.someProperty}"> <o:converter converterId="omnifaces.ListIndexConverter" list="#{bean.dualListModel.source}" /> </p:pickList>Pros and cons as compared toListConverterFor detail, refer the javadoc of SelectItemsIndexConverterand substitute "SelectItemsIndexConverter" by "ListIndexConverter" and "SelectItemsConverter" by "ListConverter".- Author:
- Arjan Tijms
 
- 
- 
Field Summary- 
Fields inherited from interface jakarta.faces.convert.ConverterDATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE_PARAM_NAME
 
- 
 - 
Constructor SummaryConstructors Constructor Description ListIndexConverter()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetAsObject(FacesContext context, UIComponent component, String value)StringgetAsString(FacesContext context, UIComponent component, Object value)voidsetList(List<?> list)Sets the list of available items.
 
- 
- 
- 
Method Detail- 
getAsObjectpublic Object getAsObject(FacesContext context, UIComponent component, String value) - Specified by:
- getAsObjectin interface- Converter<Object>
 
 - 
getAsStringpublic String getAsString(FacesContext context, UIComponent component, Object value) - Specified by:
- getAsStringin interface- Converter<Object>
 
 - 
setListpublic void setList(List<?> list) Sets the list of available items.- Parameters:
- list- The list of available items.
 
 
- 
 
-