|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.plexus.context.DefaultContext
public class DefaultContext
Default implementation of Context.
This implementation is a static hierarchial store. It has the normal 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 Summary | |
---|---|
DefaultContext()
Create a empty Context with no parent. |
|
DefaultContext(Context parent)
Create a Context with specified parent. |
|
DefaultContext(Map contextData)
Create a empty Context with specified data. |
|
DefaultContext(Map contextData,
Context parent)
Create a Context with specified data and 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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultContext(Map contextData, Context parent)
contextData
- the containerContext dataparent
- the parent Context (may be null)public DefaultContext(Map contextData)
contextData
- the containerContext datapublic DefaultContext(Context parent)
parent
- the parent Context (may be null)public DefaultContext()
Method Detail |
---|
public boolean contains(Object key)
contains
in interface Context
key
- The key to search for.
public Object get(Object key) throws ContextException
get
in interface Context
key
- The key of the value to look up.
ContextException
- If the key doesn't exist.public void put(Object key, Object value) throws IllegalStateException
put
in interface Context
key
- the items keyvalue
- the item
IllegalStateException
- if containerContext is read onlypublic void hide(Object key) throws IllegalStateException
hide
in interface Context
key
- the items key
IllegalStateException
- if containerContext is read onlypublic Map getContextData()
getContextData
in interface Context
protected Context getParent()
public void makeReadOnly()
makeReadOnly
in interface Context
protected void checkWriteable() throws IllegalStateException
IllegalStateException
- if containerContext is read only
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |