Determine 'All Known Implementing Classes'

You probably know the part of the Java Api Doc:

[quote]All Known Implementing Classes: …
[/quote]
Now, I was wondering if its possible to query all classes implementing an interface or marked with a specified annotation type at runtime?

Btw., I took a look at the Class object but did find the methods I was looking for…

blahblahblah’s code in this thread will allow you to find all classes implementing an interface

http://www.java-gaming.org/forums/index.php?topic=9240.0

Cheers,
Brett

thanks for the reply,

I guess I have to wait until http://javagamesfactory.org/ is online again…

the server is up again, but unfortunately it doesn’t work:


Class[] list = new ClassLocater().getSubclassesOf(java.util.EventListener.class);
for(Class c : list)
  System.out.println(c);

there are no classes and interfaces listed from the java.awt.event package. :frowning:

any other ideas or is this just not possible?

you might have a look at the Doclet API, in particular, the RootDoc class. Of course Sun will say not to use com.sun.* packages so you might be interested in opening up src.zip in your SDK folder and see how the Doclet API is doing it…

thanks for the answer woogley.

unfortunately, RootDoc is an interface and the two classes from the Doclet API (Doclet + LanguageVersion) seem to be dummy implementations. -> src.zip seems not to be helpful… :-\