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.| Constructor and Description |
|---|
DefaultContext()
Create an empty Context.
|
DefaultContext(Map<Object,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(Object key)
Returns true if this context contains a value for the specified key.
|
Object |
get(Object key)
Returns the value of the key.
|
Map<Object,Object> |
getContextData()
Utility method to retrieve containerContext data
|
void |
hide(Object key)
Hides the item in the containerContext.
|
void |
makeReadOnly()
Make the containerContext read-only.
|
void |
put(Object key,
Object value)
Adds the item to the containerContext.
|
String |
toString() |
public DefaultContext()
public DefaultContext(Map<Object,Object> contextData)
contextData - the containerContext datapublic boolean contains(Object key)
Contextpublic Object get(Object key) throws ContextException
Contextget in interface Contextkey - the key of the value to look up.ContextException - if the key doesn't existpublic void put(Object key, Object value) throws IllegalStateException
Contextput in interface Contextkey - the key of the itemvalue - the itemIllegalStateException - if this context is read-onlypublic void hide(Object key) throws IllegalStateException
Contexthide in interface Contextkey - the items keyIllegalStateException - if this context is read-onlypublic Map<Object,Object> getContextData()
getContextData in interface Contextpublic void makeReadOnly()
makeReadOnly in interface Contextprotected void checkWriteable()
throws IllegalStateException
IllegalStateException - if containerContext is read onlyCopyright © 2001–2019 Codehaus Plexus. All rights reserved.