public class ScopeContext extends Object implements IocContext
Constructor and Description |
---|
ScopeContext(String scope) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
accept(String scope) |
void |
clear()
清空缓存,注销资源,执行完后,当前上下文对象恢复到初始状态
|
void |
depose()
销毁当前上下文对象,清空资源,执行完后,当前上下文对象将不再可用
|
ObjectProxy |
fetch(String name)
根据对象的名称获取上下文环境中的一个对象
|
Map<String,ObjectProxy> |
getObjs() |
String |
getScope() |
Set<String> |
names() |
boolean |
remove(String scope,
String name)
从上下文环境中删一个对象。实现类根据 scope 信息来决定是否删除
|
boolean |
save(String scope,
String name,
ObjectProxy obj)
存储一个对象,根据对象的级别,各个实现类可以决定是否真的存储
|
void |
setScope(String scope) |
public ScopeContext(String scope)
public Map<String,ObjectProxy> getObjs()
public String getScope()
public void setScope(String scope)
public ObjectProxy fetch(String name)
IocContext
fetch
in interface IocContext
name
- 对象的名称public boolean save(String scope, String name, ObjectProxy obj)
IocContext
save
in interface IocContext
scope
- 对象范围name
- 对象的名称obj
- 对象本身protected boolean accept(String scope)
public boolean remove(String scope, String name)
IocContext
remove
in interface IocContext
scope
- 对象范围name
- 对象的名称public void clear()
IocContext
clear
in interface IocContext
public void depose()
IocContext
depose
in interface IocContext
public Set<String> names()
names
in interface IocContext
Copyright © 2017. All rights reserved.