I want to implement logic that will recursively scan for annotated classes. I can scan the package structure without issue:
Stack<Package> stack = new Stack<Package>();
stack.push(Package.getPackage(ROOT_PACKAGE));
while(!stack.isEmpty()) {
Package temp = stack.pop();
annotatedClasses.addAll(getAnnotatedClasses(temp));
for(Package p : temp.getPackages()) {
stack.push(p);
}
}
Where I've come unstuck is that I can't seem to find a way to implement this method:
public List<Class> getAnnotatedClasses(Package p);
Given a Package object is there a way to get all Classes within it?