public class ComboIocLoader extends AbstractLifeCycle implements IocLoader
LifeCycle.Event, LifeCycle.Listener| Modifier and Type | Field and Description |
|---|---|
protected static Map<String,Class<? extends IocLoader>> |
loaders
类别名
|
| Constructor and Description |
|---|
ComboIocLoader(IocLoader... loaders) |
ComboIocLoader(String... args)
这个构造方法需要一组特殊的参数
第一种,以*开头,后面接类名, 如
*org.nutz.ioc.loader.json.JsonLoader
支持类别名: js, json, xml, annotation, anno, trans, async, props, tx, quartz分别对应其加载类
第二种,为具体的参数
处理规律, 当遇到第一种参数(*),则认为接下来的一个或多个参数为这一个IocLoader的参数,直至遇到另外一个*开头的参数
例子:
{"*js","ioc/dao.js","ioc/service.js","*xml","ioc/config.xml", "*anoo", "net.wendal.nutzbook"}
这样的参数, 会生成一个以{"ioc/dao.js","ioc/service.js"}作为参数的JsonLoader,一个以{"ioc/dao.xml"}
作为参数的XmlIocLoader, 一个以"net.wendal.nutzbook"为参数的AnnotationIocLoader |
| Modifier and Type | Method and Description |
|---|---|
void |
addLoader(IocLoader loader) |
void |
depose() |
String[] |
getName() |
boolean |
has(String name) |
void |
init() |
IocObject |
load(IocLoading loading,
String name)
每次这个函数被调用,则要构造一个新的 IocObject
|
String |
toString() |
fetch, triggerpublic ComboIocLoader(String... args) throws ClassNotFoundException
*org.nutz.ioc.loader.json.JsonLoader
支持类别名: js, json, xml, annotation, anno, trans, async, props, tx, quartz分别对应其加载类
第二种,为具体的参数
处理规律, 当遇到第一种参数(*),则认为接下来的一个或多个参数为这一个IocLoader的参数,直至遇到另外一个*开头的参数
例子:
{"*js","ioc/dao.js","ioc/service.js","*xml","ioc/config.xml", "*anoo", "net.wendal.nutzbook"}
这样的参数, 会生成一个以{"ioc/dao.js","ioc/service.js"}作为参数的JsonLoader,一个以{"ioc/dao.xml"}
作为参数的XmlIocLoader, 一个以"net.wendal.nutzbook"为参数的AnnotationIocLoaderClassNotFoundException - 如果*开头的参数所指代的类不存在public ComboIocLoader(IocLoader... loaders)
public String[] getName()
public IocObject load(IocLoading loading, String name) throws ObjectLoadException
IocLoaderload in interface IocLoaderObjectLoadExceptionpublic void addLoader(IocLoader loader)
public void init()
throws Exception
init in interface LifeCycleinit in class AbstractLifeCycleExceptionCopyright © 2017. All rights reserved.