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;
}
Aggregations