Object o = ((VirtualNode)item).getUnderlyingNode();
if (o instanceof Node) {
nodes.add(o);
} else {
if (requireXOM) {
DynamicError err = new DynamicError("Extension function required class " + targetClass.getName() +
"; supplied value of class " + item.getClass().getName() +
" could not be converted");
throw err;
};
}
} else if (requireXOM) {
DynamicError err = new DynamicError("Extension function required class " + targetClass.getName() +
"; supplied value of class " + item.getClass().getName() +
" could not be converted");
throw err;
} else {
return null;
}
}
if (nodes.size() == 0 && !requireXOM) {
return null; // empty sequence supplied - try a different mapping
}
if (Node.class.isAssignableFrom(targetClass)) {
if (nodes.size() != 1) {
DynamicError err = new DynamicError("Extension function requires a single XOM Node" +
"; supplied value contains " + nodes.size() + " nodes");
throw err;
}
return nodes.get(0);
} else if (targetClass.isArray() && Node.class.isAssignableFrom(targetClass.getComponentType())) {