I am writing some code to check the structure of other people's code.
Lets say ClassB extends ClassA
I know I can do
Class clazz = Class.forName("classB");
clazz.getSuperclass();
clazz.getName(); //ClassA
but I dont want to do it this way because it requires my jvm return the actual class of ClassA (which is not in the classpath)
currently I am using
Class clazz = Class.forName("classB", false, classLoader);
to not initialize the class, so that I dont have to put so many irrelevant jars into my classpath.
Is there a way I can get the Super's classname from ClassB without requiring me to include ClassA's jar in the classpath?
Aucun commentaire:
Enregistrer un commentaire