public class BeanContextImpl extends Object implements Context
| Modifier and Type | Field and Description |
|---|---|
protected BeanContainer<?> |
beanContainer |
protected Context |
context |
| Constructor and Description |
|---|
BeanContextImpl() |
BeanContextImpl(Context context) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
删除上下文中的所有参数信息
|
void |
clearSubContext()
删除所有子上下文
|
BaseContext |
contain(String s)
如果上下文存在参数名称对应的参数信息,那么返回当前实例,不存在则返回null
|
Context |
createSubContext(String contextName)
创建子上下文
|
boolean |
exist(String name)
检测参数是否存在
|
<T> T |
get(String name)
获取对象,如果当前环境中没有,则到子环境当中寻找
|
<T> T |
get(String contextName,
String name) |
<T> T |
get(String name,
T defaultValue)
获取参数名称对应的参数值,如果参数值不存在,那么返回默认值
|
BeanContainer<?> |
getBeanContainer() |
<T> T |
getInSubContext(String contextName,
String name)
从指定子环境获取变量
|
Map<String,Object> |
getItemMap()
返回当前上下文(不包含子上下文)中所有内容
|
Context |
getParent()
返回父上下文对象
|
Context |
getSubContext(String contextName)
返回子环境
|
Map<String,Context> |
getSubContextMap()
返回所有子上下文组装成的map
|
Map<String,Object> |
getTotalItemMap()
返回上下文(包含子上下文)中所有内容
3.4.8.5(不包含)及以后的版本中,
返回上下文(包含父子上下文)中所有内容
|
<T> T |
put(String contextName,
String name,
T object)
添加到子环境
|
<T> T |
put(String name,
T object)
添加参数信息到上下文中
|
void |
putAll(Map<String,Object> map)
存储参数值
|
Context |
putSubContext(String contextName,
Context subContext)
添加子环境
|
<T> T |
remove(String name)
移除参数名称对应的参数值
|
<T> T |
remove(String contextName,
String name)
从子上下文中删除name的参数信息
|
Context |
removeSubContext(String contextName)
删除子上下文
|
boolean |
renameKey(String key,
String newKey)
把环境中某键值的名字换成另外的名字
|
void |
setBeanContainer(BeanContainer<?> beanContainer) |
void |
setParent(Context parent)
设置父上下文对象
|
int |
size()
返回上下文中的参数数量
|
protected Context context
protected BeanContainer<?> beanContainer
public BeanContextImpl(Context context)
public BeanContextImpl()
public BeanContainer<?> getBeanContainer()
public void setBeanContainer(BeanContainer<?> beanContainer)
public <T> T put(String name, T object)
BaseContextput in interface BaseContextname - 参数名称object - 参数值public boolean renameKey(String key, String newKey)
BaseContextrenameKey in interface BaseContextkey - 旧的参数名称newKey - 新的参数名称public <T> T remove(String name)
BaseContextremove in interface BaseContextname - 参数名称public <T> T get(String name)
BaseContextget in interface BaseContextname - 参数名称public void putAll(Map<String,Object> map)
BaseContextputAll in interface BaseContextmap - 多个参数组成的map数据结构public <T> T get(String name, T defaultValue)
BaseContextget in interface BaseContextname - 参数名称defaultValue - 默认值public int size()
BaseContextsize in interface BaseContextpublic boolean exist(String name)
BaseContextexist in interface BaseContextname - 参数名称public BaseContext contain(String s)
BaseContextcontain in interface BaseContexts - 参数名称public void clear()
BaseContextclear in interface BaseContextpublic Map<String,Object> getItemMap()
ContextgetItemMap in interface BaseContextgetItemMap in interface Contextpublic Context createSubContext(String contextName)
ContextcreateSubContext in interface ContextcontextName - 上下文名称public <T> T remove(String contextName, String name)
Contextpublic <T> T put(String contextName, String name, T object)
Contextpublic Context putSubContext(String contextName, Context subContext)
ContextputSubContext in interface ContextcontextName - 子环境public Context removeSubContext(String contextName)
ContextremoveSubContext in interface ContextcontextName - 子环境public Context getSubContext(String contextName)
ContextgetSubContext in interface ContextcontextName - 子环境public void clearSubContext()
ContextclearSubContext in interface Contextpublic Map<String,Context> getSubContextMap()
ContextgetSubContextMap in interface Contextpublic <T> T getInSubContext(String contextName, String name)
ContextgetInSubContext in interface ContextcontextName - 子环境name - 上下文变量名称Copyright © 2006–2018 TinyGroup. All rights reserved.