return createChildBuilder(current, name, attributes);
} else if (current == null || current instanceof NanoContainer) {
NanoContainer parent = (NanoContainer) current;
Object parentAttribute = attributes.get(PARENT);
if (parent != null && parentAttribute != null) {
throw new NanoContainerMarkupException("You can't explicitly specify a parent in a child element.");
}
if (parent == null && (parentAttribute instanceof MutablePicoContainer)) {
// we're not in an enclosing scope - look at parent attribute instead
parent = new DefaultNanoContainer((MutablePicoContainer) parentAttribute);
}
if (parent == null && (parentAttribute instanceof NanoContainer)) {
// we're not in an enclosing scope - look at parent attribute instead
parent = (NanoContainer) parentAttribute;
}
if (name.equals(CONTAINER)) {
return createChildContainer(attributes, parent);
} else {
try {
return createChildOfContainerNode(parent, name, attributes, current);
} catch (ClassNotFoundException e) {
throw new NanoContainerMarkupException("ClassNotFoundException: " + e.getMessage(), e);
}
}
} else if (current instanceof ClassPathElement) {
if (name.equals(GRANT)) {
return createGrantPermission(attributes, (ClassPathElement) current);