vendredi 25 septembre 2015

Java Reflections: Get Classes but not SubTypes

I'm upgrading from org.reflections:reflections:0.9.5 to version 0.9.9. I am using:

Reflections reflectionPaths = new Reflections("resources", new TypeAnnotationsScanner());
Set<Class<?>> rootResourceClasses = reflectionPaths.getTypesAnnotatedWith(Path.class);

Which gets me all classes in the resources package with an @Path Annotation. Since the library has been updated the top line requires an extra new SubTypesScanner() for the code to run. I however do not want sub types to be returned.

How can I use this new version of the library to pull back only classes and interfaces that are not sub types?





Aucun commentaire:

Enregistrer un commentaire