| Modifier and Type | Field and Description |
|---|---|
protected Date |
createTime |
| Modifier | Constructor and Description |
|---|---|
|
NutIoc(IocLoader loader) |
|
NutIoc(IocLoader loader,
IocContext context,
String defaultScope) |
protected |
NutIoc(ObjectMaker maker,
IocLoader loader,
IocContext context,
String defaultScope) |
protected |
NutIoc(ObjectMaker maker,
IocLoader loader,
IocContext context,
String defaultScope,
MirrorFactory mirrors) |
| Modifier and Type | Method and Description |
|---|---|
void |
addValueProxyMaker(ValueProxyMaker vpm)
增加 ValuePfoxyMaker
|
void |
depose()
将容器注销,触发对象的 depose 事件
|
protected void |
finalize() |
<T> T |
get(Class<T> type)
从容器中获取一个对象。这个对象的名称会根据传入的类型按如下规则决定
如果定义了注解 '@InjectName',采用其值为注入名
否则采用类型 simpleName 的首字母小写形式作为注入名
|
<T> T |
get(Class<T> type,
String name)
从容器中获取一个对象。同时会触发对象的 fetch 事件。如果第一次构建对象 则会先触发对象 create 事件
|
<T> T |
get(Class<T> type,
String name,
IocContext context)
这是更高级的 Ioc 获取对象的方法,它传给 Ioc 容器一个上下文环境。
容器以此作为参考,决定如何构建对象,或者将对象缓存在何处 |
<K> K |
getByType(Class<K> klass) |
<K> K |
getByType(Class<K> klass,
IocContext context) |
IocContext |
getIocContext()
获取容器的上下文对象
|
String[] |
getNames() |
String[] |
getNamesByType(Class<?> klass) |
String[] |
getNamesByType(Class<?> klass,
IocContext context) |
boolean |
has(String name) |
IocMaking |
makeIocMaking(IocContext context,
String name)
暴露IocMaking的创建过程
|
void |
reset()
将容器恢复成初始创建状态,所有的缓存都将被清空
|
void |
setDefaultScope(String defaultScope) |
void |
setMaker(ObjectMaker maker) |
void |
setMirrorFactory(MirrorFactory mirrors) |
String |
toString() |
protected Date createTime
public NutIoc(IocLoader loader)
public NutIoc(IocLoader loader, IocContext context, String defaultScope)
protected NutIoc(ObjectMaker maker, IocLoader loader, IocContext context, String defaultScope)
protected NutIoc(ObjectMaker maker, IocLoader loader, IocContext context, String defaultScope, MirrorFactory mirrors)
public <T> T get(Class<T> type) throws IocException
Iocget in interface Ioctype - 类型IocExceptionpublic <T> T get(Class<T> type, String name, IocContext context) throws IocException
Ioc2get in interface Ioc2type - 对象的类型name - 对象的名称context - 对象的上下文环境IocExceptionIocpublic <T> T get(Class<T> type, String name)
Iocpublic boolean has(String name)
public void depose()
Iocpublic void reset()
Iocpublic String[] getNames()
public void addValueProxyMaker(ValueProxyMaker vpm)
Ioc2addValueProxyMaker in interface Ioc2ValueProxy,
ValueProxyMakerpublic IocContext getIocContext()
Ioc2getIocContext in interface Ioc2public void setMaker(ObjectMaker maker)
public void setMirrorFactory(MirrorFactory mirrors)
public void setDefaultScope(String defaultScope)
public IocMaking makeIocMaking(IocContext context, String name)
protected void finalize()
throws Throwable
public String[] getNamesByType(Class<?> klass)
getNamesByType in interface Iocpublic String[] getNamesByType(Class<?> klass, IocContext context)
getNamesByType in interface Ioc2public <K> K getByType(Class<K> klass, IocContext context)
Copyright © 2017. All rights reserved.