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)
Context
public Object get(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(Object key, Object value) throws IllegalStateException
Context
put
in interface Context
key
- the key of the itemvalue
- the itemIllegalStateException
- if this context is read-onlypublic void hide(Object key) throws IllegalStateException
Context
hide
in interface Context
key
- the items keyIllegalStateException
- if this context is read-onlypublic Map<Object,Object> getContextData()
getContextData
in interface Context
public void makeReadOnly()
makeReadOnly
in interface Context
protected void checkWriteable() throws IllegalStateException
IllegalStateException
- if containerContext is read onlyCopyright © 2001–2019 Codehaus Plexus. All rights reserved.