org.richfaces.component

## Class PartialStateHolderHelper

- java.lang.Object
- - org.richfaces.component.PartialStateHolderHelper

- All Implemented Interfaces:
    javax.faces.component.StateHelper, javax.faces.component.StateHolder
  Direct Known Subclasses:
    BehaviorStateHelper

      public class PartialStateHolderHelper
      extends Object
      implements javax.faces.component.StateHelper

  Since:
    Feb 2, 2010 A base implementation for maps which implement the PartialStateHolder interface.

    This can be used as a base-class for all state-holder implementations in components, converters and validators and other implementations of the StateHolder interface.
  Author:
    akolonitsky

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PartialStateHolderHelper(javax.faces.component.PartialStateHolder stateHolder)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(Serializable key, Object value)`
    `Object` | `eval(Serializable key)`
    `Object` | `eval(Serializable key, Object defaultValue)`
    `Object` | `get(Serializable key)` Get the object from the main-map.
    `protected Object` | `getValueExpressionValue(String name)`
    `boolean` | `isTransient()`
    `Object` | `put(Serializable key, Object value)` Put the object in the main-map and/or the delta-map, if necessary.
    `Object` | `put(Serializable key, String mapKey, Object value)`
    `Object` | `remove(Serializable key)` We need to remove from both maps, if we do remove an existing key.
    `Object` | `remove(Serializable key, Object valueOrKey)`
    `void` | `restoreState(javax.faces.context.FacesContext context, Object state)` One and only implementation of restore state.
    `Object` | `saveState(javax.faces.context.FacesContext context)` One and only implementation of save-state - makes all other implementations unnecessary.
    `void` | `setTransient(boolean newTransientValue)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PartialStateHolderHelper

          public PartialStateHolderHelper(javax.faces.component.PartialStateHolder stateHolder)

  - ### Method Detail

    - #### put

          public Object put(Serializable key,
                   Object value)

      Put the object in the main-map and/or the delta-map, if necessary.
      Specified by:
        `put` in interface `javax.faces.component.StateHelper`
      Parameters:
        `key` -
        `value` -
      Returns:
        the original value in the delta-map, if not present, the old value in the main map

    - #### remove

          public Object remove(Serializable key)

      We need to remove from both maps, if we do remove an existing key.
      Specified by:
        `remove` in interface `javax.faces.component.StateHelper`
      Parameters:
        `key` -
      Returns:
        the removed object in the delta-map. if not present, the removed object from the main map

    - #### put

          public Object put(Serializable key,
                   String mapKey,
                   Object value)

      Specified by:
        `put` in interface `javax.faces.component.StateHelper`
      See Also:
        `StateHelper.put(java.io.Serializable, String, Object)`

    - #### get

          public Object get(Serializable key)

      Get the object from the main-map. As everything is written through from the delta-map to the main-map, this should be enough.
      Specified by:
        `get` in interface `javax.faces.component.StateHelper`
      Parameters:
        `key` -
      Returns:

    - #### eval

          public Object eval(Serializable key)

      Specified by:
        `eval` in interface `javax.faces.component.StateHelper`
      See Also:
        `StateHelper.eval(java.io.Serializable)`

    - #### eval

          public Object eval(Serializable key,
                    Object defaultValue)

      Specified by:
        `eval` in interface `javax.faces.component.StateHelper`
      See Also:
        `StateHelper.eval(java.io.Serializable, Object)`

    - #### getValueExpressionValue

          protected Object getValueExpressionValue(String name)

    - #### add

          public void add(Serializable key,
                 Object value)

      Specified by:
        `add` in interface `javax.faces.component.StateHelper`
      See Also:
        `StateHelper.add(java.io.Serializable, Object)`

    - #### remove

          public Object remove(Serializable key,
                      Object valueOrKey)

      Specified by:
        `remove` in interface `javax.faces.component.StateHelper`
      See Also:
        `StateHelper.remove(java.io.Serializable, Object)`

    - #### saveState

          public Object saveState(javax.faces.context.FacesContext context)

      One and only implementation of save-state - makes all other implementations unnecessary.
      Specified by:
        `saveState` in interface `javax.faces.component.StateHolder`
      Parameters:
        `context` -
      Returns:
        the saved state

    - #### restoreState

          public void restoreState(javax.faces.context.FacesContext context,
                          Object state)

      One and only implementation of restore state. Makes all other implementations unnecessary.
      Specified by:
        `restoreState` in interface `javax.faces.component.StateHolder`
      Parameters:
        `context` - FacesContext
        `state` - the state to be restored.

    - #### isTransient

          public boolean isTransient()

      Specified by:
        `isTransient` in interface `javax.faces.component.StateHolder`
      See Also:
        `StateHolder.isTransient()`

    - #### setTransient

          public void setTransient(boolean newTransientValue)

      Specified by:
        `setTransient` in interface `javax.faces.component.StateHolder`
      See Also:
        `StateHolder.setTransient(boolean)`

Copyright © 2014 JBoss by Red Hat. All Rights Reserved.