public final class ClassPathUtil
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T> java.util.List<java.lang.Class<T>> |
getAllClassesExtending(java.lang.Class<T> targetClass)
Gets all classes extending the given target class.
|
static <T> java.util.List<java.lang.Class<T>> |
getAllClassesExtending(java.lang.String packageName,
java.lang.Class<T> targetClass)
Gets all classes extending the given target class.
|
static java.util.List<java.lang.reflect.Method> |
getAllMethodsAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Gets all methods annotated with the specified annotation.
|
static java.util.List<java.lang.reflect.Method> |
getAllMethodsAnnotatedWith(java.lang.String packageName,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Gets all methods inside the package annotated with the specified annotation.
|
static <T> T |
getInstanceOfExtending(java.lang.Class<T> targetClass)
Gets a
Class.newInstance() of the first class extending the given target class. |
public static <T> T getInstanceOfExtending(java.lang.Class<T> targetClass)
throws java.lang.Exception
Class.newInstance() of the first class extending the given target class.T - targetClass - the given target classjava.lang.Exceptionpublic static <T> java.util.List<java.lang.Class<T>> getAllClassesExtending(java.lang.Class<T> targetClass)
throws java.io.IOException
T - targetClass - the given target classjava.io.IOExceptionpublic static <T> java.util.List<java.lang.Class<T>> getAllClassesExtending(java.lang.String packageName,
java.lang.Class<T> targetClass)
throws java.io.IOException
T - packageName - the package where you seektargetClass - the given target classjava.io.IOExceptionpublic static java.util.List<java.lang.reflect.Method> getAllMethodsAnnotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
throws java.io.IOException
annotationClass - java.io.IOExceptionpublic static java.util.List<java.lang.reflect.Method> getAllMethodsAnnotatedWith(java.lang.String packageName,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
throws java.io.IOException
packageName - the name of the packageannotationClass - the annotation you seekjava.io.IOException