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