// NodeType.getDeclaredSupertypeNames();
if (method.getName().equals("getSupertypes") && method.getParameterTypes().length == 0) {
NodeType[] superTypes = new NodeType[superTypeNames.length];
for (int i = 0; i < superTypeNames.length; i++) {
String aSuperTypeName = superTypeNames[i];
NodeType aSuperType = getNodeType(aSuperTypeName);
superTypes[i] = aSuperType;
}
return superTypes;
}
// Object.toString() , Object.hashCode(), Object.equals
if (method.getDeclaringClass() == Object.class) {
if (method.getName().equals("toString") && method.getParameterTypes().length == 0) {
return proxy.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(proxy));
}
if (method.getName().equals("hashCode") && method.getParameterTypes().length == 0) {
return System.identityHashCode(proxy);
}
if (method.getName().equals("equals") && method.getParameterTypes().length == 1) {
return proxy == args[0];
}
}
return null;
}
};
NodeType nodeType = (NodeType) Proxy.newProxyInstance(NodeType.class.getClassLoader(),
new Class[] { NodeType.class }, ih);
return nodeType;
}