org.omnifaces.util.selectitems
Class SelectItemsBuilder

java.lang.Object
  extended by org.omnifaces.util.selectitems.SelectItemsBuilder

public class SelectItemsBuilder
extends java.lang.Object

Helper class to build an array of SelectItems using various means, like via the builder pattern or a given Map.

Author:
Arjan Tijms

Constructor Summary
SelectItemsBuilder()
           
 
Method Summary
 SelectItemsBuilder add(java.lang.Object value, java.lang.String label)
           
 javax.faces.model.SelectItem[] build()
           
 java.util.List<javax.faces.model.SelectItem> buildList()
           
static java.util.List<javax.faces.model.SelectItem> fromMap(java.util.Map<?,?> map)
          Builds a List of SelectItems from the given Map argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectItemsBuilder

public SelectItemsBuilder()
Method Detail

add

public SelectItemsBuilder add(java.lang.Object value,
                              java.lang.String label)

build

public javax.faces.model.SelectItem[] build()

buildList

public java.util.List<javax.faces.model.SelectItem> buildList()

fromMap

public static java.util.List<javax.faces.model.SelectItem> fromMap(java.util.Map<?,?> map)
Builds a List of SelectItems from the given Map argument.

Parameters:
map - the Map
Returns:
List of SelectItems having the map's value as value and the map's key as label.