假设我有
class A{}
class B extends A{}
class C extends A{}
class D extends C{}
class E extends B{}
我有以下代码
Reflections reflections = new Reflections();
Set<Class<? extends A>> classes = reflections.getSubTypesOf(A.class);
集合classes
是否包含类D
和E
???
答案 0 :(得分:0)
是
import java.util.Set;
import org.reflections.Reflections;
public class Test {
public static void main(String[] args) throws java.lang.Exception {
Reflections reflections = new Reflections();
Set<Class<? extends A>> classes = reflections.getSubTypesOf(A.class);
System.out.println(classes);
}
}
class A {
}
class B extends A {
}
class C extends A {
}
class D extends C {
}
class E extends B {
}
输出:[class C, class D, class B, class E]