I have this interface
:
public interface Handler {...}
and a class that implements it:
public class DefaultHandler implements Handler {...}
Both are placed in same package: com.app.hello
In that same package, I have another class with this method (that uses Reflections library):
public int getHandlersCount() {
Reflections reflections = new Reflections("com.app.hello");
Set<Class<? extends EventHandler>> handlers = reflections.getSubTypesOf(EventHandler.class);
return handlers.size();
}
However, it returns always 0. It doesn't find DefaultHandler
as subtype of Handler
.
Aucun commentaire:
Enregistrer un commentaire