Search in sources :

Example 16 with IocObject

use of org.nutz.ioc.meta.IocObject in project nutz by nutzam.

the class XmlIocLoader method paserBean.

protected String paserBean(Element beanElement, boolean innerBean) throws Throwable {
    String beanId;
    if (innerBean) {
        beanId = "inner$" + innerId;
        innerId++;
    } else
        beanId = beanElement.getAttribute("name");
    if (beanId == null)
        throw Lang.makeThrow("No name for one bean!");
    if (iocMap.containsKey(beanId))
        throw Lang.makeThrow("Name of bean is not unique! name=" + beanId);
    if (LOG.isDebugEnabled())
        LOG.debugf("Resolving bean define, name = %s", beanId);
    IocObject iocObject = new IocObject();
    String beanType = beanElement.getAttribute("type");
    if (!Strings.isBlank(beanType))
        iocObject.setType(Lang.loadClass(beanType));
    String beanScope = beanElement.getAttribute("scope");
    if (!Strings.isBlank(beanScope))
        iocObject.setScope(beanScope);
    String beanParent = beanElement.getAttribute("parent");
    if (!Strings.isBlank(beanParent))
        parentMap.put(beanId, beanParent);
    String factory = beanElement.getAttribute("factory");
    if (!Strings.isBlank(factory))
        iocObject.setFactory(factory);
    parseArgs(beanElement, iocObject);
    parseFields(beanElement, iocObject);
    parseEvents(beanElement, iocObject);
    iocMap.put(beanId, iocObject);
    if (LOG.isDebugEnabled())
        LOG.debugf("Resolved bean define, name = %s", beanId);
    return beanId;
}
Also used : IocObject(org.nutz.ioc.meta.IocObject)

Aggregations

IocObject (org.nutz.ioc.meta.IocObject)16 IocException (org.nutz.ioc.IocException)6 ArrayList (java.util.ArrayList)5 ObjectProxy (org.nutz.ioc.ObjectProxy)4 IocEventSet (org.nutz.ioc.meta.IocEventSet)4 IocField (org.nutz.ioc.meta.IocField)4 IocValue (org.nutz.ioc.meta.IocValue)4 IocContext (org.nutz.ioc.IocContext)3 IocLoader (org.nutz.ioc.IocLoader)3 ObjectLoadException (org.nutz.ioc.ObjectLoadException)3 Field (java.lang.reflect.Field)2 Method (java.lang.reflect.Method)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Test (org.junit.Test)2 ValueProxy (org.nutz.ioc.ValueProxy)2 Collection (java.util.Collection)1 Entry (java.util.Map.Entry)1 AsyncAopIocLoader (org.nutz.aop.interceptor.async.AsyncAopIocLoader)1 TransIocLoader (org.nutz.aop.interceptor.ioc.TransIocLoader)1