org.apache.avalon.framework.context
Class DefaultContext
java.lang.Object
org.apache.avalon.framework.context.DefaultContext
- Context
public class DefaultContext
extends java.lang.Object
Default implementation of Context.
This implementation is a static hierarchial store.
Version:
- Avalon Development Team
protected void | checkWriteable() - Utility method to check if context is writeable and if not throw exception.
|
Object | get(Object key) - Retrieve an item from the Context.
|
protected Map | getContextData() - Utility method to retrieve context data.
|
protected Context | getParent() - Get parent context if any.
|
void | hide(Object key) - Hides the item in the context.
|
void | makeReadOnly() - Make the context read-only.
|
void | put(Object key, Object value) - Helper method fo adding items to Context.
|
DefaultContext
public DefaultContext()
Create a Context with no parent.
DefaultContext
public DefaultContext(Map contextData)
Create a Context with specified data.
contextData
- the context data
DefaultContext
public DefaultContext(Map contextData,
Context parent)
Create a Context with specified data and parent.
contextData
- the context dataparent
- the parent Context (may be null)
DefaultContext
public DefaultContext(Context parent)
Create a Context with specified parent.
parent
- the parent Context (may be null)
checkWriteable
protected final void checkWriteable()
throws IllegalStateException
Utility method to check if context is writeable and if not throw exception.
getContextData
protected final Map getContextData()
Utility method to retrieve context data.
- the context data
getParent
protected final Context getParent()
Get parent context if any.
- the parent Context (may be null)
hide
public void hide(Object key)
throws IllegalStateException
Hides the item in the context.
After remove(key) has been called, a get(key)
will always fail, even if the parent context
has such a mapping.
key
- the items key
makeReadOnly
public void makeReadOnly()
Make the context read-only.
Any attempt to write to the context via put()
will result in an IllegalStateException.
put
public void put(Object key,
Object value)
throws IllegalStateException
Helper method fo adding items to Context.
key
- the items keyvalue
- the item
"Copyright B) 2001 Apache Jakarta Project. All Rights Reserved."