}
public JPConverter getJPConverter(Class targetClass) {
if (Node.class.isAssignableFrom(targetClass) && !(NodeOverNodeInfo.class.isAssignableFrom(targetClass))) {
return new JPConverter() {
public ValueRepresentation convert(Object obj, XPathContext context) throws XPathException {
return wrapOrUnwrapNode((Node)obj, context.getConfiguration());
}
public ItemType getItemType() {
return AnyNodeTest.getInstance();
}
};
} else if (NodeList.class.isAssignableFrom(targetClass)) {
return new JPConverter() {
public ValueRepresentation convert(Object obj, XPathContext context) throws XPathException {
Configuration config = context.getConfiguration();
NodeList list = ((NodeList)obj);
final int len = list.getLength();
NodeInfo[] nodes = new NodeInfo[len];