org.omnifaces.util
Class State

java.lang.Object
  extended by org.omnifaces.util.State

public class State
extends java.lang.Object

Helper class for StateHelper that uses generic type-inference to make code that uses the StateHelper slightly less verbose.

Since:
1.1
Author:
Arjan Tijms

Constructor Summary
State(javax.faces.component.StateHelper stateHelper)
           
 
Method Summary
<T> T
get(java.io.Serializable key)
          Attempts to find a value associated with the specified key in the component's state.
<T> T
get(java.io.Serializable key, java.lang.Object defaultValue)
          Attempts to find a value associated with the specified key in the component's state.
<T> T
put(java.io.Serializable key, T value)
          Puts a value in the component's state and returns the previous value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

State

public State(javax.faces.component.StateHelper stateHelper)
Method Detail

get

public <T> T get(java.io.Serializable key)
Attempts to find a value associated with the specified key in the component's state.

See StateHelper.eval(Serializable)

Parameters:
key - the name of the value in component's state

get

public <T> T get(java.io.Serializable key,
                 java.lang.Object defaultValue)
Attempts to find a value associated with the specified key in the component's state.

See StateHelper.eval(Serializable, Object)

Parameters:
key - the name of the value in component's state
defaultValue - the value to return if no value is found in the call to get()

put

public <T> T put(java.io.Serializable key,
                 T value)
Puts a value in the component's state and returns the previous value. Note that the previous value has to be of the same type as the value being set. If this is unwanted, use the original StateHelper.

See StateHelper.put(Serializable, Object)

Parameters:
key -
value -