org.barracudamvc.plankton.data
Class AbstractPData

java.lang.Object
  extended by org.barracudamvc.plankton.data.AbstractPData
All Implemented Interfaces:
Serializable, Cloneable, PData, StateMap
Direct Known Subclasses:
PArrayList, PHashMap

public abstract class AbstractPData
extends Object
implements PData

Abstract implementation of the basic PData methods.

See Also:
Serialized Form

Field Summary
protected  boolean inheritParents
           
protected  PData parent
           
protected  DefaultStateMap state
           
 
Constructor Summary
AbstractPData()
           
 
Method Summary
 void clearState()
          clear all state information
 PData getParent()
          get the objects parent (null if root)
 PData getRootParent()
          get the root parent by chaining back up the heirarchy until we find the highest PData object in the heirarchy.
 Object getState(Object key)
          get a property in this StateMap
 Set getStateKeys()
          get a keyset for this StateMap (whether or not the set is backed by the data store depends on the implementation)
 Map getStateStore()
          get a copy of the underlying Map that holds the state values
 boolean isInheritParents()
          Return true if we are inheriting parents.
 void putState(Object key, Object val)
          set a property in this StateMap
 Object removeState(Object key)
          remove a property in this StateMap
 void setInheritParents(boolean val)
          Do we want to inherit parents.
 void setParent(PData p)
          set the object's parent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

protected PData parent

inheritParents

protected boolean inheritParents

state

protected DefaultStateMap state
Constructor Detail

AbstractPData

public AbstractPData()
Method Detail

setParent

public void setParent(PData p)
set the object's parent. May be some other PData object or null (indicating hierarchy root). May not be a reference to self.

Specified by:
setParent in interface PData
Parameters:
p - the parent PData object

getParent

public PData getParent()
get the objects parent (null if root)

Specified by:
getParent in interface PData
Returns:
the PData object

getRootParent

public PData getRootParent()
get the root parent by chaining back up the heirarchy until we find the highest PData object in the heirarchy.

Specified by:
getRootParent in interface PData
Returns:
the root PData object

setInheritParents

public void setInheritParents(boolean val)
Do we want to inherit parents. Defaults to true. This indicates that when an object is added to this data collection, if it implements PData, it should automatically inherit the current object as its parent. You would typically set this to false if you were going to be storing PData "mini-hierarchies" within a larger PData hierarchy

Specified by:
setInheritParents in interface PData
Parameters:
val - true if we should inherit parents

isInheritParents

public boolean isInheritParents()
Return true if we are inheriting parents.

Specified by:
isInheritParents in interface PData
Returns:
true if we are inheriting parents

putState

public void putState(Object key,
                     Object val)
set a property in this StateMap

Specified by:
putState in interface StateMap
Parameters:
key - the key object
val - the value object

getState

public Object getState(Object key)
get a property in this StateMap

Specified by:
getState in interface StateMap
Parameters:
key - the key object
Returns:
the value for the given key

removeState

public Object removeState(Object key)
remove a property in this StateMap

Specified by:
removeState in interface StateMap
Parameters:
key - the key object
Returns:
the object which was removed

getStateKeys

public Set getStateKeys()
get a keyset for this StateMap (whether or not the set is backed by the data store depends on the implementation)

Specified by:
getStateKeys in interface StateMap
Returns:
a Set of keys for this StateMap

getStateStore

public Map getStateStore()
get a copy of the underlying Map that holds the state values

Specified by:
getStateStore in interface StateMap
Returns:
a copy of the underlying state Map

clearState

public void clearState()
clear all state information

Specified by:
clearState in interface StateMap


Copyright © 2006 BarracudaMVC.org All Rights Reserved.