public static < P extends Parameterizable > Set < P > getParameterizables ( Package javaPackage , Class < P > clazz ) throws IOException , FileNotFoundException , ClassNotFoundException , InstantiationException , IllegalAccessException , NoSuchMethodException , InvocationTargetException { Set < P > parameterizables = new HashSet <> ( 50 ) ; for ( Class < ? > c : ClassHelper . fromPackage ( javaPackage ) ) { if ( clazz . isAssignableFrom ( c ) && ! Modifier . isAbstract ( c . getModifiers ( ) ) ) { P p = ( P ) c . newInstance ( ) ; ParamAnnotationProcessor . PAP . initParameters ( p ) ; parameterizables . add ( p ) ; } } return parameterizables ; }
Use this generic method in for example a gui that supports building a styling file .