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.| Modifier and Type | Field and Description |
|---|---|
private java.util.concurrent.ConcurrentMap<java.lang.Object,java.lang.Object> |
contextData
Context data.
|
private java.util.concurrent.atomic.AtomicBoolean |
readOnly
Is the containerContext read only.
|
| 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<java.lang.Object,java.lang.Object> |
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() |
private final java.util.concurrent.ConcurrentMap<java.lang.Object,java.lang.Object> contextData
private final java.util.concurrent.atomic.AtomicBoolean readOnly
public DefaultContext()
public DefaultContext(java.util.Map<java.lang.Object,java.lang.Object> contextData)
contextData - the containerContext datapublic boolean contains(java.lang.Object key)
Contextpublic java.lang.Object get(java.lang.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(java.lang.Object key,
java.lang.Object value)
throws java.lang.IllegalStateException
Contextpublic void hide(java.lang.Object key)
throws java.lang.IllegalStateException
Contextpublic java.util.Map<java.lang.Object,java.lang.Object> getContextData()
getContextData in interface Contextpublic void makeReadOnly()
makeReadOnly in interface Contextprotected void checkWriteable()
throws java.lang.IllegalStateException
java.lang.IllegalStateException - if containerContext is read onlypublic java.lang.String toString()
toString in class java.lang.Object