Given the following snippet:
Set<Class<? extends MyClass>> allClasses =
new Reflections("mypackage").getSubTypesOf(MyClass.class);
The library recursively search for all the classes extending MyClass
in the given package and subpackages. I need to do this in the given package only, i.e., not in the subpackages. Is there a way to do so?
This is brute force, but:
1) Get subclasses of MyClass. Put in a set.
2) Iterate over classes in the set; remove classes which belong to other packages (i.e. those for which _someClass.getPackage().equals(MyClass.class.getPackage()) is false)