net.sf.morph.context.contexts
Class BaseHierarchicalContext

java.lang.Object
  extended by net.sf.morph.context.contexts.BaseContext
      extended by net.sf.morph.context.contexts.BaseHierarchicalContext
All Implemented Interfaces:
java.util.Map, Context, DecoratedContext, HierarchicalContext
Direct Known Subclasses:
ReflectorHierarchicalContext

public abstract class BaseHierarchicalContext
extends BaseContext
implements HierarchicalContext

Convenient base class for hierarchical Contexts. Validates arguments and takes care of logging and exception handling. Also implements the Map interface.

Since:
Nov 29, 2004
Author:
Matt Sgarlata
See Also:
net.sf.morph.context.support.BaseContext, HierarchicalContext

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
BaseHierarchicalContext()
          Creates a new, empty context.
BaseHierarchicalContext(Context parentContext)
          Creates a new, empty context with the specified parent.
 
Method Summary
protected abstract  java.lang.Object getHierarchicalImpl(java.lang.String propertyName)
           
protected  java.lang.Object getImpl(java.lang.String propertyName)
          Implement get(propertyName).
 Context getParentContext()
          Retrieves this context's parent context.
protected abstract  java.lang.String[] getPropertyNamesHierarchicalImpl()
           
protected  java.lang.String[] getPropertyNamesImpl()
          Implement getPropertyNames()
protected abstract  void setHierarchicalImpl(java.lang.String propertyName, java.lang.Object propertyValue)
           
protected  void setImpl(java.lang.String propertyName, java.lang.Object propertyValue)
          Implement set(propertyName, propertyValue).
 void setParentContext(Context parentContext)
          Sets this context's parent context.
 
Methods inherited from class net.sf.morph.context.contexts.BaseContext
clear, containsKey, containsValue, entrySet, get, get, get, get, get, getContextMapBridge, getConverter, getLanguage, getLog, getPropertyNames, isEmpty, keySet, put, putAll, remove, set, set, setContextMapBridge, setConverter, setLanguage, setLog, size, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.morph.context.HierarchicalContext
get, getPropertyNames, set
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

BaseHierarchicalContext

public BaseHierarchicalContext()
Creates a new, empty context.


BaseHierarchicalContext

public BaseHierarchicalContext(Context parentContext)
Creates a new, empty context with the specified parent.

Method Detail

getHierarchicalImpl

protected abstract java.lang.Object getHierarchicalImpl(java.lang.String propertyName)
                                                 throws java.lang.Exception
Throws:
java.lang.Exception

getPropertyNamesHierarchicalImpl

protected abstract java.lang.String[] getPropertyNamesHierarchicalImpl()
                                                                throws java.lang.Exception
Throws:
java.lang.Exception

setHierarchicalImpl

protected abstract void setHierarchicalImpl(java.lang.String propertyName,
                                            java.lang.Object propertyValue)
                                     throws java.lang.Exception
Throws:
java.lang.Exception

getImpl

protected final java.lang.Object getImpl(java.lang.String propertyName)
                                  throws java.lang.Exception
Description copied from class: BaseContext
Implement get(propertyName).

Specified by:
getImpl in class BaseContext
Parameters:
propertyName - to get
Returns:
Object value
Throws:
java.lang.Exception - in case of errors

getPropertyNamesImpl

protected final java.lang.String[] getPropertyNamesImpl()
                                                 throws java.lang.Exception
Description copied from class: BaseContext
Implement getPropertyNames()

Specified by:
getPropertyNamesImpl in class BaseContext
Returns:
String[] of property names
Throws:
java.lang.Exception - if errors occur

setImpl

protected final void setImpl(java.lang.String propertyName,
                             java.lang.Object propertyValue)
                      throws java.lang.Exception
Description copied from class: BaseContext
Implement set(propertyName, propertyValue).

Specified by:
setImpl in class BaseContext
Parameters:
propertyName - to set
propertyValue - to set
Throws:
java.lang.Exception - in case of errors

setParentContext

public void setParentContext(Context parentContext)
Sets this context's parent context.

Specified by:
setParentContext in interface HierarchicalContext
Parameters:
parentContext - this context's parent context

getParentContext

public Context getParentContext()
Description copied from interface: HierarchicalContext
Retrieves this context's parent context.

Specified by:
getParentContext in interface HierarchicalContext
Returns:
this context's parent context


Copyright © 2004-2008.