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 context will not search in the parent context for the value.
Version: $Id: DefaultContext.java 1323 2004-12-20 23:00:59Z jvanzyl $
| 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 context 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 context 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. |
| 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 for adding items to Context.
|
Parameters: contextData the context data parent the parent Context (may be null)
Parameters: contextData the context data
Parameters: parent the parent Context (may be null)
Throws: java.lang.IllegalStateException if context 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 context data
Returns: the parent Context (may be null)
Parameters: key the items key
Throws: java.lang.IllegalStateException if context is read only
Parameters: key the items key value the item
Throws: java.lang.IllegalStateException if context is read only