javax.faces.component
Class _DeltaStateHelper

java.lang.Object
  extended by javax.faces.component._DeltaStateHelper
All Implemented Interfaces:
StateHelper, StateHolder

public class _DeltaStateHelper
extends java.lang.Object
implements StateHelper

A delta enabled state holder implementing the StateHolder Interface.

Components implementing the PartalStateHolder interface have an initial state and delta states, the initial state is the one holding all root values and deltas store differences to the initial states

For components not implementing partial state saving only the initial states are of importance, everything is stored and restored continously there

The state helper seems to have three internal storage mechanisms: one being a list which stores plain values, one being a key value pair which stores key values in maps add serves the plain list type while put serves the key value type, the third is the value which has to be stored plainly as is!

In other words, this map can be seen as a composite map. It has two maps: initial state map and delta map.

If delta map is used (method component.initialStateMarked() ), base or initial state map cannot be changed, since all changes should be tracked on delta map.

The intention of this class is just hold property values and do a clean separation between initial state and delta.

The code from this class comes from a refactor of org.apache.myfaces.trinidad.bean.util.PropertyHashMap

The context from this class comes and that should be taken into account is this:

First request:

Second request (and next ones)

From the previous analysis, the following conclusions arise:

NOTE: The current implementation of StateHelper on RI does not handle stateHolder values internally. To prevent problems when developers create custom components we should do this too. But anyway, the code that handle this case should be let here as comment, if some day this feature is provided. Note than stateHolder aware properties like converter, validator or listeners should deal with StateHolder or PartialStateHolder on component classes.

Version:
$Rev: 788877 $ $Date: 2009-06-26 16:30:38 -0500 (Fri, 26 Jun 2009) $
Author:
Werner Punz, Leonardo Uribe (latest modification by $Author: lu4242 $)

Constructor Summary
_DeltaStateHelper(UIComponent component)
           
 
Method Summary
 void add(java.io.Serializable key, java.lang.Object value)
           
 java.lang.Object eval(java.io.Serializable key)
           
 java.lang.Object eval(java.io.Serializable key, java.lang.Object defaultValue)
           
 java.lang.Object get(java.io.Serializable key)
           
protected  boolean isInitialStateMarked()
           
 boolean isTransient()
           
 java.lang.Object put(java.io.Serializable key, java.lang.Object value)
           
 java.lang.Object put(java.io.Serializable key, java.lang.String mapKey, java.lang.Object value)
           
 java.lang.Object remove(java.io.Serializable key)
           
 java.lang.Object remove(java.io.Serializable key, java.lang.Object valueOrKey)
           
 void restoreState(FacesContext context, java.lang.Object state)
           
 java.lang.Object saveState(FacesContext context)
          Serializing cod the serialized data structure consists of key value pairs unless the value itself is an internal array or a map in case of an internal array or map the value itself is another array with its initial value myfaces.InternalArray, myfaces.internalMap the internal Array is then mapped to another array the internal Map again is then mapped to a map with key value pairs
 void setTransient(boolean transientValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

_DeltaStateHelper

public _DeltaStateHelper(UIComponent component)
Method Detail

isInitialStateMarked

protected boolean isInitialStateMarked()

add

public void add(java.io.Serializable key,
                java.lang.Object value)
Specified by:
add in interface StateHelper

eval

public java.lang.Object eval(java.io.Serializable key)
Specified by:
eval in interface StateHelper

eval

public java.lang.Object eval(java.io.Serializable key,
                             java.lang.Object defaultValue)
Specified by:
eval in interface StateHelper

get

public java.lang.Object get(java.io.Serializable key)
Specified by:
get in interface StateHelper

put

public java.lang.Object put(java.io.Serializable key,
                            java.lang.Object value)
Specified by:
put in interface StateHelper

put

public java.lang.Object put(java.io.Serializable key,
                            java.lang.String mapKey,
                            java.lang.Object value)
Specified by:
put in interface StateHelper

remove

public java.lang.Object remove(java.io.Serializable key)
Specified by:
remove in interface StateHelper

remove

public java.lang.Object remove(java.io.Serializable key,
                               java.lang.Object valueOrKey)
Specified by:
remove in interface StateHelper

isTransient

public boolean isTransient()
Specified by:
isTransient in interface StateHolder

saveState

public java.lang.Object saveState(FacesContext context)
Serializing cod the serialized data structure consists of key value pairs unless the value itself is an internal array or a map in case of an internal array or map the value itself is another array with its initial value myfaces.InternalArray, myfaces.internalMap the internal Array is then mapped to another array the internal Map again is then mapped to a map with key value pairs

Specified by:
saveState in interface StateHolder

restoreState

public void restoreState(FacesContext context,
                         java.lang.Object state)
Specified by:
restoreState in interface StateHolder

setTransient

public void setTransient(boolean transientValue)
Specified by:
setTransient in interface StateHolder


Copyright © 2009 The Apache Software Foundation. All Rights Reserved.