org.codehaus.plexus.context
public class DefaultContext extends Object implements Context
get()
and put
methods. The hide
method will hide a property. When
a property has been hidden the containerContext will not search in the parent containerContext for the value.
Version: $Id: DefaultContext.java 6585 2007-07-04 17:37:22Z kenney $
Nested Class Summary | |
---|---|
static class | DefaultContext.Hidden
This class is only used as a marker in the map to indicate a hidden value. |
Field Summary | |
---|---|
Map | contextData Context data. |
static DefaultContext.Hidden | HIDDEN_MAKER |
Context | parent Parent Context. |
boolean | readOnly Is the containerContext read only. |
Constructor Summary | |
---|---|
DefaultContext(Map contextData, Context parent)
Create a Context with specified data and parent.
| |
DefaultContext(Map contextData)
Create a empty Context with specified data.
| |
DefaultContext(Context parent)
Create a Context with specified parent.
| |
DefaultContext()
Create a empty Context with no parent. |
Method Summary | |
---|---|
protected void | checkWriteable()
Utility method to check if containerContext is writeable and if not throw exception.
|
boolean | contains(Object key)
Returns true if the map or the parent map contains the key.
|
Object | get(Object key)
Returns the value of the key. |
Map | getContextData()
Utility method to retrieve containerContext data
|
protected Context | getParent()
Get parent containerContext if any.
|
void | hide(Object key)
Hides the item in the containerContext.
|
void | makeReadOnly()
Make the containerContext read-only.
|
void | put(Object key, Object value)
Helper method for adding items to Context.
|
Parameters: contextData the containerContext data parent the parent Context (may be null)
Parameters: contextData the containerContext data
Parameters: parent the parent Context (may be null)
Throws: java.lang.IllegalStateException if containerContext is read only
Parameters: key The key to search for.
Returns: Returns true if the key was found.
Parameters: key The key of the value to look up.
Returns: Returns
Throws: ContextException If the key doesn't exist.
Returns: the containerContext data
Returns: the parent Context (may be null)
Parameters: key the items key
Throws: java.lang.IllegalStateException if containerContext is read only
Parameters: key the items key value the item
Throws: java.lang.IllegalStateException if containerContext is read only