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)
BaseContext
put
in interface BaseContext
name
- 参数名称object
- 参数值public boolean renameKey(String key, String newKey)
BaseContext
renameKey
in interface BaseContext
key
- 旧的参数名称newKey
- 新的参数名称public <T> T remove(String name)
BaseContext
remove
in interface BaseContext
name
- 参数名称public <T> T get(String name)
BaseContext
get
in interface BaseContext
name
- 参数名称public void putAll(Map<String,Object> map)
BaseContext
putAll
in interface BaseContext
map
- 多个参数组成的map数据结构public <T> T get(String name, T defaultValue)
BaseContext
get
in interface BaseContext
name
- 参数名称defaultValue
- 默认值public int size()
BaseContext
size
in interface BaseContext
public boolean exist(String name)
BaseContext
exist
in interface BaseContext
name
- 参数名称public BaseContext contain(String s)
BaseContext
contain
in interface BaseContext
s
- 参数名称public void clear()
BaseContext
clear
in interface BaseContext
public Map<String,Object> getItemMap()
Context
getItemMap
in interface BaseContext
getItemMap
in interface Context
public Context createSubContext(String contextName)
Context
createSubContext
in interface Context
contextName
- 上下文名称public <T> T remove(String contextName, String name)
Context
public <T> T put(String contextName, String name, T object)
Context
public Context putSubContext(String contextName, Context subContext)
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 Map<String,Context> getSubContextMap()
Context
getSubContextMap
in interface Context
public <T> T getInSubContext(String contextName, String name)
Context
getInSubContext
in interface Context
contextName
- 子环境name
- 上下文变量名称Copyright © 2006–2018 TinyGroup. All rights reserved.