public class ComboContext extends Object implements IocContext
每当获取时 按照构造Context的顺序,依次获取。 只要有一个 Context 返回了非 null 对象,就立即返回
| 构造器和说明 |
|---|
ComboContext(IocContext... contexts)
Context 的获取优先级,以数组的顺序来决定
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clear()
清空缓存,注销资源,执行完后,当前上下文对象恢复到初始状态
|
void |
depose()
销毁当前上下文对象,清空资源,执行完后,当前上下文对象将不再可用
|
ObjectProxy |
fetch(String key)
根据对象的名称获取上下文环境中的一个对象
|
IocContext[] |
getContexts() |
Set<String> |
names() |
boolean |
remove(String scope,
String name)
从上下文环境中删一个对象。
|
boolean |
save(String scope,
String name,
ObjectProxy obj)
存储一个对象,根据对象的级别,各个实现类可以决定是否真的存储
|
public ComboContext(IocContext... contexts)
contexts - public ObjectProxy fetch(String key)
IocContextfetch 在接口中 IocContextkey - 对象的名称public boolean save(String scope, String name, ObjectProxy obj)
IocContextsave 在接口中 IocContextscope - 对象范围name - 对象的名称obj - 对象本身public boolean remove(String scope, String name)
IocContextremove 在接口中 IocContextscope - 对象范围name - 对象的名称public void clear()
IocContextclear 在接口中 IocContextpublic void depose()
IocContextdepose 在接口中 IocContextpublic IocContext[] getContexts()
public Set<String> names()
names 在接口中 IocContextCopyright © 2017. All rights reserved.