public void alias (String name, Class type) {
this.aliases.put(name, type);
}
public T instantiateNode (B builder, ObjectFactoryInterceptor ofi, String nodeName, T parent) {
MetaClass mc = ofi.getMetaClassForNode(nodeName);
if (mc == null) {
if (this.aliases.containsKey(nodeName)) {
ofi.setMetaClassForNode(nodeName, InvokerHelper.getMetaClass(this.aliases.get(nodeName)));
} else {
String newNodeName = nodeName.substring(0, 1).toUpperCase() + nodeName.substring(1);
for (String pkg : this.pkgs) {
try {
Class clazz = Class.forName(pkg + "." + newNodeName, false, Thread.currentThread().getContextClassLoader());
ofi.setMetaClassForNode(nodeName, mc = InvokerHelper.getMetaClass(clazz));
break;
} catch (ClassNotFoundException e) {}
}
if (mc == null) ofi.setMetaClassForNode(nodeName, null);
}
}
return (T) (mc == null ? null : mc.invokeConstructor(parent == null || !ofi.isPassParentToConstructor() ? EMPTY_ARRAY : new Object[] { parent }));
}