public class DefaultContext extends Object implements Context, Serializable
Constructor and Description |
---|
DefaultContext()
Create a Context with no parent.
|
DefaultContext(Context parent)
Create a Context with specified parent.
|
DefaultContext(Map contextData)
Create a Context with specified data.
|
DefaultContext(Map contextData,
Context parent)
Create a Context with specified data and parent.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkWriteable()
Utility method to check if context is writeable and if not throw exception.
|
boolean |
equals(Object o)
Check for equality between two DefaultContext objects.
|
Object |
get(Object key)
Retrieve an item from the Context.
|
protected Map |
getContextData()
Utility method to retrieve context data.
|
protected Context |
getParent()
Get parent context if any.
|
int |
hashCode() |
void |
hide(Object key)
Hides the item in the context.
|
void |
makeReadOnly()
Make the context read-only.
|
void |
put(Object key,
Object value)
Helper method fo adding items to Context.
|
public DefaultContext(Map contextData, Context parent)
contextData
- the context dataparent
- the parent Context (may be null)public DefaultContext(Map contextData)
contextData
- the context datapublic DefaultContext(Context parent)
parent
- the parent Context (may be null)public DefaultContext()
public Object get(Object key) throws ContextException
get
in interface Context
key
- the key of itemContextException
- if item not presentpublic void put(Object key, Object value) throws IllegalStateException
key
- the items keyvalue
- the itemIllegalStateException
- if context is read onlypublic void hide(Object key) throws IllegalStateException
key
- the items keyIllegalStateException
- if context is read onlyprotected final Map getContextData()
protected final Context getParent()
public void makeReadOnly()
protected final void checkWriteable() throws IllegalStateException
IllegalStateException
- if context is read onlypublic boolean equals(Object o)
Equality is said to be true if, and only if, the following criteria are met;
Copyright © 2022. All rights reserved.