Package org.apache.jorphan.reflect
Class ClassFinder
java.lang.Object
org.apache.jorphan.reflect.ClassFinder
This class finds classes that extend one of a set of parent classes
-
Method Summary
Modifier and TypeMethodDescriptionfindAnnotatedClasses
(String[] strPathsOrJars, Class<? extends Annotation>[] annotations) Find classes in the provided path(s)/jar(s) that extend the class(es).findAnnotatedClasses
(String[] strPathsOrJars, Class<? extends Annotation>[] annotations, boolean innerClasses) Find classes in the provided path(s)/jar(s) that extend the class(es).findClassesThatExtend
(String[] paths, Class<?>[] superClasses) Convenience method forfindClassesThatExtend(String[], Class[], boolean)
with the option to include inner classes in the search set to false.findClassesThatExtend
(String[] strPathsOrJars, Class<?>[] superClasses, boolean innerClasses) Find classes in the provided path(s)/jar(s) that extend the class(es).findClassesThatExtend
(String[] strPathsOrJars, Class<?>[] superClasses, boolean innerClasses, String contains, String notContains) Find classes in the provided path(s)/jar(s) that extend the class(es).findClassesThatExtend
(String[] searchPathsOrJars, Class<?>[] classNames, boolean innerClasses, String contains, String notContains, boolean annotations) Find classes in the provided path(s)/jar(s) that extend the class(es).
-
Method Details
-
findClassesThatExtend
public static List<String> findClassesThatExtend(String[] paths, Class<?>[] superClasses) throws IOException Convenience method forfindClassesThatExtend(String[], Class[], boolean)
with the option to include inner classes in the search set to false.- Parameters:
paths
- pathnames or jarfiles to search for classessuperClasses
- required parent class(es)- Returns:
- List of Strings containing discovered class names.
- Throws:
IOException
- when scanning the classes fails
-
findClassesThatExtend
public static List<String> findClassesThatExtend(String[] strPathsOrJars, Class<?>[] superClasses, boolean innerClasses) throws IOException Find classes in the provided path(s)/jar(s) that extend the class(es).- Parameters:
strPathsOrJars
- - pathnames or jarfiles to search for classessuperClasses
- - required parent class(es)innerClasses
- - should we include inner classes?- Returns:
- List containing discovered classes
- Throws:
IOException
- when scanning for classes fails
-
findClassesThatExtend
public static List<String> findClassesThatExtend(String[] strPathsOrJars, Class<?>[] superClasses, boolean innerClasses, String contains, String notContains) throws IOException Find classes in the provided path(s)/jar(s) that extend the class(es).- Parameters:
strPathsOrJars
- - pathnames or jarfiles to search for classessuperClasses
- - required parent class(es)innerClasses
- - should we include inner classes?contains
- - classname should contain this stringnotContains
- - classname should not contain this string- Returns:
- List containing discovered classes
- Throws:
IOException
- when scanning classes fails
-
findAnnotatedClasses
public static List<String> findAnnotatedClasses(String[] strPathsOrJars, Class<? extends Annotation>[] annotations, boolean innerClasses) throws IOException Find classes in the provided path(s)/jar(s) that extend the class(es).- Parameters:
strPathsOrJars
- - pathnames or jarfiles to search for classesannotations
- - required annotationsinnerClasses
- - should we include inner classes?- Returns:
- List containing discovered classes
- Throws:
IOException
- when scanning classes fails
-
findAnnotatedClasses
public static List<String> findAnnotatedClasses(String[] strPathsOrJars, Class<? extends Annotation>[] annotations) throws IOException Find classes in the provided path(s)/jar(s) that extend the class(es). Inner classes are not searched.- Parameters:
strPathsOrJars
- - pathnames or jarfiles to search for classesannotations
- - required annotations- Returns:
- List containing discovered classes
- Throws:
IOException
- when scanning classes fails
-
findClassesThatExtend
public static List<String> findClassesThatExtend(String[] searchPathsOrJars, Class<?>[] classNames, boolean innerClasses, String contains, String notContains, boolean annotations) throws IOException Find classes in the provided path(s)/jar(s) that extend the class(es).- Parameters:
searchPathsOrJars
- - pathnames or jarfiles to search for classesclassNames
- - required parent class(es) or annotationsinnerClasses
- - should we include inner classes?contains
- - classname should contain this stringnotContains
- - classname should not contain this stringannotations
- - true if classnames are annotations- Returns:
- List containing discovered classes
- Throws:
IOException
- when scanning classes fails
-