question: public static List < Class < ? > > findAllImplementations ( Class < ? > c , boolean everything , boolean parameterizable ) { if ( c == null ) { return Collections . emptyList ( ) ; } if ( ! everything && parameterizable ) { return findAllImplementations ( c ) ; } if ( ! contains ( c ) ) { ELKIServiceLoader . load ( c ) ; ELKIServiceScanner . load ( c ) ; } List < Class < ? > > known = findAllImplementations ( c ) ; HashSet < Class < ? > > dupes = new HashSet < > ( known ) ; for ( Iterator < Class < ? > > iter = ELKIServiceScanner . nonindexedClasses ( ) ; iter . hasNext ( ) ; ) { Class < ? > cls = iter . next ( ) ; if ( dupes . contains ( cls ) ) { continue ; } if ( ! everything && ( Modifier . isInterface ( cls . getModifiers ( ) ) || Modifier . isAbstract ( cls . getModifiers ( ) ) || Modifier . isPrivate ( cls . getModifiers ( ) ) ) ) { continue ; } if ( ! c . isAssignableFrom ( cls ) ) { continue ; } if ( parameterizable ) { boolean instantiable = false ; try { instantiable = cls . getConstructor ( ) != null ; } catch ( Exception | Error e ) { } try { instantiable = instantiable || ClassGenericsUtil . getParameterizer ( cls ) != null ; } catch ( Exception | Error e ) { } if ( ! instantiable ) { continue ; } } known . add ( cls ) ; dupes . add ( cls ) ; } return known ; }
target:  Find all implementations of a given class in the classpath. Note: returned classes may be abstract.