com.ibm.xsp.util
Class StateHolderUtil

java.lang.Object
  extended by com.ibm.xsp.util.StateHolderUtil

public class StateHolderUtil
extends java.lang.Object

Utility used by UIComponent and StateHolder implementations, to save and restore maps of StateHolders, lists, etc. Control properties that have String, int, or other primitive values can be serialized without this utility, but generally any more complicated property values should be saved and restored through the methods available here. Each save method has a corresponding restore method, and the paired methods should be used together.


Constructor Summary
StateHolderUtil()
           
 
Method Summary
static java.lang.Object[] restoreArray(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object state)
          Restore the state of an array of StateHolders
static void restoreDataContainers(javax.faces.context.FacesContext context, java.util.Map<java.lang.String,DataContainer> containers, java.lang.Object[] state)
          Save the data containers
static
<T> java.util.List<T>
restoreList(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object state)
           
static
<K,V> java.util.Map<K,V>
restoreMap(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object state)
          Restore the state of a Map of StateHolders
static javax.faces.el.MethodBinding restoreMethodBinding(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object state)
          Restore the state of a MethodBinding
static java.lang.Object restoreObjectState(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object state)
           
static PropertyMap restorePropertyMap(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object state)
          Restore the state of a list of StateHolders
static
<T> java.util.Set<T>
restoreSet(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object state)
          Restore the state of a set of StateHolders
static
<T extends javax.faces.component.StateHolder>
T
restoreStateHolder(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object state)
           
static void restoreStateHolder(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object state, javax.faces.component.StateHolder recreatedStateHolder)
          Where the object to restore has already been created, this restores the saved state onto the object.
static javax.faces.el.ValueBinding restoreValueBinding(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object state)
          Restore the state of a ValueBinding
static java.util.Map<java.lang.String,javax.faces.el.ValueBinding> restoreValueBindings(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object state)
          Restore the state of a map of ValueBindings
static java.lang.Object saveArray(javax.faces.context.FacesContext context, java.lang.Object[] array, boolean isStateHolder)
          Save the state of a list of StateHolders
static java.lang.Object saveDataContainers(javax.faces.context.FacesContext context, java.util.Map<java.lang.String,DataContainer> containers)
          Save the data containers, note, the containers should implement Externalizable.
static
<T> java.lang.Object
saveList(javax.faces.context.FacesContext context, java.util.List<T> list)
          Save the state of a list of StateHolders
static
<T> java.lang.Object
saveList(javax.faces.context.FacesContext context, java.util.List<T> list, boolean isStateHolder)
          Save the state of a list of StateHolders
static
<K,V> java.lang.Object
saveMap(javax.faces.context.FacesContext context, java.util.Map<K,V> map)
          Save the state of a map of StateHolders
static
<K,V> java.lang.Object
saveMap(javax.faces.context.FacesContext context, java.util.Map<K,V> map, boolean isStateHolder)
          Save the state of a map of values
static java.lang.Object saveMethodBinding(javax.faces.context.FacesContext context, javax.faces.el.MethodBinding binding)
          Save the state of a MethodBinding
static java.lang.Object saveObjectState(javax.faces.context.FacesContext context, java.lang.Object object)
          The object may or may not implement StateHolder (it can save either kind).
static java.lang.Object savePropertyMap(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, PropertyMap properties)
          Save the state of a list of a property map.
static
<T> java.lang.Object
saveSet(javax.faces.context.FacesContext context, java.util.Set<T> set)
          Save the state of a Set of StateHolders
static
<T> java.lang.Object
saveSet(javax.faces.context.FacesContext context, java.util.Set<T> set, boolean isStateHolder)
          Save the state of a set of values
static java.lang.Object saveStateHolder(javax.faces.context.FacesContext context, javax.faces.component.StateHolder stateHolder)
           
static java.lang.Object saveValueBinding(javax.faces.context.FacesContext context, javax.faces.el.ValueBinding binding)
          Save the state of a ValueBinding
static java.lang.Object saveValueBindings(javax.faces.context.FacesContext context, java.util.Map<java.lang.String,javax.faces.el.ValueBinding> bindings)
          Save the state of a map of ValueBindings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateHolderUtil

public StateHolderUtil()
Method Detail

restoreArray

public static java.lang.Object[] restoreArray(javax.faces.context.FacesContext context,
                                              javax.faces.component.UIComponent component,
                                              java.lang.Object state)
Restore the state of an array of StateHolders


saveArray

public static java.lang.Object saveArray(javax.faces.context.FacesContext context,
                                         java.lang.Object[] array,
                                         boolean isStateHolder)
Save the state of a list of StateHolders


restoreList

public static <T> java.util.List<T> restoreList(javax.faces.context.FacesContext context,
                                                javax.faces.component.UIComponent component,
                                                java.lang.Object state)

restorePropertyMap

public static PropertyMap restorePropertyMap(javax.faces.context.FacesContext context,
                                             javax.faces.component.UIComponent component,
                                             java.lang.Object state)
Restore the state of a list of StateHolders


saveList

public static <T> java.lang.Object saveList(javax.faces.context.FacesContext context,
                                            java.util.List<T> list)
Save the state of a list of StateHolders


saveList

public static <T> java.lang.Object saveList(javax.faces.context.FacesContext context,
                                            java.util.List<T> list,
                                            boolean isStateHolder)
Save the state of a list of StateHolders


restoreSet

public static <T> java.util.Set<T> restoreSet(javax.faces.context.FacesContext context,
                                              javax.faces.component.UIComponent component,
                                              java.lang.Object state)
Restore the state of a set of StateHolders


saveSet

public static <T> java.lang.Object saveSet(javax.faces.context.FacesContext context,
                                           java.util.Set<T> set)
Save the state of a Set of StateHolders


saveSet

public static <T> java.lang.Object saveSet(javax.faces.context.FacesContext context,
                                           java.util.Set<T> set,
                                           boolean isStateHolder)
Save the state of a set of values


restoreMap

public static <K,V> java.util.Map<K,V> restoreMap(javax.faces.context.FacesContext context,
                                                  javax.faces.component.UIComponent component,
                                                  java.lang.Object state)
Restore the state of a Map of StateHolders


saveMap

public static <K,V> java.lang.Object saveMap(javax.faces.context.FacesContext context,
                                             java.util.Map<K,V> map)
Save the state of a map of StateHolders


saveMap

public static <K,V> java.lang.Object saveMap(javax.faces.context.FacesContext context,
                                             java.util.Map<K,V> map,
                                             boolean isStateHolder)
Save the state of a map of values


savePropertyMap

public static java.lang.Object savePropertyMap(javax.faces.context.FacesContext context,
                                               javax.faces.component.UIComponent component,
                                               PropertyMap properties)
Save the state of a list of a property map.


saveValueBindings

public static java.lang.Object saveValueBindings(javax.faces.context.FacesContext context,
                                                 java.util.Map<java.lang.String,javax.faces.el.ValueBinding> bindings)
Save the state of a map of ValueBindings


restoreValueBindings

public static java.util.Map<java.lang.String,javax.faces.el.ValueBinding> restoreValueBindings(javax.faces.context.FacesContext context,
                                                                                               javax.faces.component.UIComponent component,
                                                                                               java.lang.Object state)
Restore the state of a map of ValueBindings


restoreValueBinding

public static javax.faces.el.ValueBinding restoreValueBinding(javax.faces.context.FacesContext context,
                                                              javax.faces.component.UIComponent component,
                                                              java.lang.Object state)
Restore the state of a ValueBinding


saveValueBinding

public static java.lang.Object saveValueBinding(javax.faces.context.FacesContext context,
                                                javax.faces.el.ValueBinding binding)
Save the state of a ValueBinding


restoreMethodBinding

public static javax.faces.el.MethodBinding restoreMethodBinding(javax.faces.context.FacesContext context,
                                                                javax.faces.component.UIComponent component,
                                                                java.lang.Object state)
Restore the state of a MethodBinding


saveMethodBinding

public static java.lang.Object saveMethodBinding(javax.faces.context.FacesContext context,
                                                 javax.faces.el.MethodBinding binding)
Save the state of a MethodBinding


saveDataContainers

public static java.lang.Object saveDataContainers(javax.faces.context.FacesContext context,
                                                  java.util.Map<java.lang.String,DataContainer> containers)
Save the data containers, note, the containers should implement Externalizable.


restoreDataContainers

public static void restoreDataContainers(javax.faces.context.FacesContext context,
                                         java.util.Map<java.lang.String,DataContainer> containers,
                                         java.lang.Object[] state)
Save the data containers


saveObjectState

public static java.lang.Object saveObjectState(javax.faces.context.FacesContext context,
                                               java.lang.Object object)
The object may or may not implement StateHolder (it can save either kind).


restoreObjectState

public static java.lang.Object restoreObjectState(javax.faces.context.FacesContext context,
                                                  javax.faces.component.UIComponent component,
                                                  java.lang.Object state)

saveStateHolder

public static java.lang.Object saveStateHolder(javax.faces.context.FacesContext context,
                                               javax.faces.component.StateHolder stateHolder)

restoreStateHolder

public static <T extends javax.faces.component.StateHolder> T restoreStateHolder(javax.faces.context.FacesContext context,
                                                                                 javax.faces.component.UIComponent component,
                                                                                 java.lang.Object state)

restoreStateHolder

public static void restoreStateHolder(javax.faces.context.FacesContext context,
                                      javax.faces.component.UIComponent component,
                                      java.lang.Object state,
                                      javax.faces.component.StateHolder recreatedStateHolder)
Where the object to restore has already been created, this restores the saved state onto the object.

Parameters:
context -
component -
state -
recreatedStateHolder -