Created
October 1, 2014 09:40
-
-
Save saksmt/baebd25deca65a792aee to your computer and use it in GitHub Desktop.
Java: get all implementations of interface
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Interface {} | |
class InterfaceImpl1 implements Interface {} | |
class InterfaceImpl2 implements Interface {} | |
class Main { | |
private static List<Class<? extends Interface>> interfaceImplementations; | |
static { | |
interfaceImplementations = new ArrayList(Interface.class.getClasses()); // <- Doesn't work :( | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment