public class ContextImpl extends BaseContextImpl implements Context, Serializable
Constructor and Description |
---|
ContextImpl() |
ContextImpl(Map map) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
删除上下文中的所有参数信息
|
void |
clearSubContext()
删除所有子上下文
|
Context |
contain(String name)
如果上下文存在参数名称对应的参数信息,那么返回当前实例,不存在则返回null
|
protected Context |
containNodeMap(String name,
Context contextNode,
Map<Context,String> nodeMap) |
Context |
createSubContext(String contextName)
创建子上下文
|
boolean |
exist(String name)
检测参数是否存在
|
protected boolean |
existNodeMap(String name,
Context contextNode,
Map<Context,String> nodeMap) |
protected <T> T |
findNodeMap(String name,
Context contextNode,
Map<Context,String> nodeMap) |
<T> T |
get(String name)
改写get方法,使得可以从父环境中查找,同时,也可以从子环境中查找 先找自己,再找子,再找父
|
<T> T |
getInSubContext(String contextName,
String name)
从指定子环境获取变量
|
Map<String,Object> |
getItemMap()
返回上下文中所有参数
|
Context |
getParent()
返回父上下文对象
|
Context |
getSubContext(String contextName)
返回子环境
|
Map<String,Context> |
getSubContextMap()
返回所有子上下文组装成的map
|
protected void |
getTotalContext(Context contextNode,
List<Context> list) |
Map<String,Object> |
getTotalItemMap()
返回上下文(包含子上下文)中所有内容
3.4.8.5(不包含)及以后的版本中,
返回上下文(包含父子上下文)中所有内容
|
<T> T |
put(String contextName,
String name,
T object)
添加到子环境
|
void |
putContext(String contextName,
Context context)
设置儿子环境,但儿子的不设置当前为父亲
|
Context |
putSubContext(String contextName,
Context context)
添加子环境
|
<T> T |
remove(String contextName,
String name)
从子上下文中删除name的参数信息
|
Context |
removeSubContext(String contextName)
删除子上下文
|
boolean |
renameKey(String key,
String newKey)
把环境中某键值的名字换成另外的名字
|
protected boolean |
renameKeyNodeMap(String key,
String newKey,
Context contextNode,
Map<Context,String> nodeMap) |
void |
setParent(Context parent)
设置父上下文对象
|
get, put, putAll, remove, setItemMap, size
public ContextImpl()
public ContextImpl(Map map)
public Context createSubContext(String contextName)
Context
createSubContext
in interface Context
contextName
- 上下文名称public Context putSubContext(String contextName, Context context)
Context
putSubContext
in interface Context
contextName
- 子环境public Context removeSubContext(String contextName)
Context
removeSubContext
in interface Context
contextName
- 子环境public Context getSubContext(String contextName)
Context
getSubContext
in interface Context
contextName
- 子环境public void clearSubContext()
Context
clearSubContext
in interface Context
public void clear()
BaseContext
clear
in interface BaseContext
clear
in class BaseContextImpl
public Map<String,Context> getSubContextMap()
Context
getSubContextMap
in interface Context
public <T> T remove(String contextName, String name)
Context
public <T> T getInSubContext(String contextName, String name)
Context
getInSubContext
in interface Context
contextName
- 子环境name
- 上下文变量名称public <T> T put(String contextName, String name, T object)
Context
public <T> T get(String name)
get
in interface BaseContext
get
in class BaseContextImpl
name
- 参数名称public Map<String,Object> getTotalItemMap()
Context
getTotalItemMap
in interface Context
protected <T> T findNodeMap(String name, Context contextNode, Map<Context,String> nodeMap)
protected boolean existNodeMap(String name, Context contextNode, Map<Context,String> nodeMap)
protected Context containNodeMap(String name, Context contextNode, Map<Context,String> nodeMap)
public boolean renameKey(String key, String newKey)
BaseContext
renameKey
in interface BaseContext
renameKey
in class BaseContextImpl
key
- 旧的参数名称newKey
- 新的参数名称protected boolean renameKeyNodeMap(String key, String newKey, Context contextNode, Map<Context,String> nodeMap)
public boolean exist(String name)
BaseContext
exist
in interface BaseContext
exist
in class BaseContextImpl
name
- 参数名称public Context contain(String name)
BaseContext
contain
in interface BaseContext
contain
in class BaseContextImpl
name
- 参数名称public Map<String,Object> getItemMap()
BaseContext
getItemMap
in interface BaseContext
getItemMap
in interface Context
getItemMap
in class BaseContextImpl
Copyright © 2006–2018 TinyGroup. All rights reserved.