org.codehaus.plexus.context
public class DefaultContext extends java.lang.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.Constructor and Description |
---|
DefaultContext()
Create an empty Context.
|
DefaultContext(java.util.Map<java.lang.Object,java.lang.Object> contextData)
Create a Context with specified data.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkWriteable()
Utility method to check if containerContext is writeable and if not throw exception.
|
boolean |
contains(java.lang.Object key)
Returns true if this context contains a value for the specified key.
|
java.lang.Object |
get(java.lang.Object key)
Returns the value of the key.
|
java.util.Map |
getContextData()
Utility method to retrieve containerContext data
|
void |
hide(java.lang.Object key)
Hides the item in the containerContext.
|
void |
makeReadOnly()
Make the containerContext read-only.
|
void |
put(java.lang.Object key,
java.lang.Object value)
Adds the item to the containerContext.
|
java.lang.String |
toString() |
public DefaultContext()
public DefaultContext(java.util.Map<java.lang.Object,java.lang.Object> contextData)
contextData
- the containerContext datapublic boolean contains(java.lang.Object key)
Context
public java.lang.Object get(java.lang.Object key) throws ContextException
Context
get
in interface Context
key
- the key of the value to look up.ContextException
- if the key doesn't existpublic void put(java.lang.Object key, java.lang.Object value) throws java.lang.IllegalStateException
Context
public void hide(java.lang.Object key) throws java.lang.IllegalStateException
Context
public java.util.Map getContextData()
getContextData
in interface Context
public void makeReadOnly()
makeReadOnly
in interface Context
protected void checkWriteable() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if containerContext is read onlypublic java.lang.String toString()
toString
in class java.lang.Object