public class SimpleContext extends Object implements Context, Serializable
Constructor and Description |
---|
SimpleContext()
Constructor.
|
SimpleContext(Context parent)
Constructor.
|
SimpleContext(Context parent,
Map initialVars)
Constructor.
|
SimpleContext(Map initialVars)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Object |
get(String name)
Get the value of this variable; delegating to parent.
|
protected org.apache.commons.logging.Log |
getLog()
Get the log used by this
Context instance. |
Context |
getParent()
Get the parent Context, may be null.
|
Map |
getVars()
Get the Map of all local variables in this Context.
|
boolean |
has(String name)
Check if this variable exists, delegating to parent.
|
void |
reset()
Clear this Context.
|
void |
set(String name,
Object value)
Assigns a new value to an existing variable or creates a new one.
|
void |
setLocal(String name,
Object value)
Assigns a new value to an existing variable or creates a new one.
|
protected void |
setLog(org.apache.commons.logging.Log log)
Set the log used by this
Context instance. |
protected void |
setVars(Map vars)
Set the variables map.
|
public SimpleContext()
public SimpleContext(Context parent)
parent
- A parent Context, can be nullpublic SimpleContext(Map initialVars)
initialVars
- A pre-populated initial variables mappublic void set(String name, Object value)
set
in interface Context
name
- The variable namevalue
- The variable valueContext.set(String, Object)
public Object get(String name)
get
in interface Context
name
- The variable nameContext.get(java.lang.String)
public boolean has(String name)
has
in interface Context
name
- The variable nameContext.has(java.lang.String)
public void reset()
reset
in interface Context
Context.reset()
public Context getParent()
getParent
in interface Context
Context.getParent()
public void setLocal(String name, Object value)
setLocal
in interface Context
name
- The variable namevalue
- The variable valueContext.setLocal(String, Object)
protected void setVars(Map vars)
vars
- The new Map of variables.public Map getVars()
getVars
in interface Context
Context.getParent()
protected void setLog(org.apache.commons.logging.Log log)
Context
instance.log
- The new log.protected org.apache.commons.logging.Log getLog()
Context
instance.Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.