public final class AnnotationUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static Set<Class<?>> |
getAllAnnotatedClasses(String packagePath,
Class<? extends Annotation> annotationClass)
Gets all annotated classes that belongs from the given package path and the given annotation
class.
|
static Set<Class<?>> |
getAllAnnotatedClassesFromSet(String packagePath,
Set<Class<? extends Annotation>> annotationClasses)
Gets all annotated classes that belongs from the given package path and the given list with
annotation classes.
|
static Set<Class<?>> |
getAllClasses(String packagePath)
Gets all the classes from the class loader that belongs to the given package path.
|
static Set<Class<?>> |
getAllClasses(String packagePath,
Set<Class<? extends Annotation>> annotationClasses)
Gets all the classes from the class loader that belongs to the given package path.
|
static <T extends Annotation> |
getAnnotation(Class<?> componentClass,
Class<T> annotationClass)
Search for the given annotationClass in the given componentClass and return it if search was
successful.
|
static boolean |
isAnnotationPresentInSuperClasses(Class<?> componentClass,
Class<? extends Annotation> annotationClass)
Checks if is annotation present through making a lookup if the given annotation class is
present in the given class or in one of the super classes.
|
static boolean |
isAnnotationPresentInSuperClassesOrInterfaces(Class<?> componentClass,
Class<? extends Annotation> annotationClass)
Checks if is annotation present through making a lookup if the given annotation class is
present in the given class or in one of the super classes.
|
static Set<Class<?>> |
scanForAnnotatedClasses(File directory,
String packagePath,
Class<? extends Annotation> annotationClass)
Scan recursive for annotated classes in the given directory.
|
static Set<Class<?>> |
scanForAnnotatedClassesFromSet(File directory,
String packagePath,
Set<Class<? extends Annotation>> annotationClasses)
Scan recursive for annotated classes in the given directory.
|
static Set<Class<?>> |
scanForClasses(File directory,
String packagePath)
Scan recursive for classes in the given directory.
|
public static Set<Class<?>> getAllAnnotatedClasses(String packagePath, Class<? extends Annotation> annotationClass) throws ClassNotFoundException, IOException
packagePath - the package pathannotationClass - the annotation classClassNotFoundException - the class not found exceptionIOException - Signals that an I/O exception has occurred.public static Set<Class<?>> getAllAnnotatedClassesFromSet(String packagePath, Set<Class<? extends Annotation>> annotationClasses) throws ClassNotFoundException, IOException
packagePath - the package pathannotationClasses - the list with the annotation classesClassNotFoundException - the class not found exceptionIOException - Signals that an I/O exception has occurred.public static Set<Class<?>> getAllClasses(String packagePath) throws ClassNotFoundException, IOException
packagePath - the package pathClassNotFoundException - the class not found exceptionIOException - Signals that an I/O exception has occurred.public static Set<Class<?>> getAllClasses(String packagePath, Set<Class<? extends Annotation>> annotationClasses) throws ClassNotFoundException, IOException
packagePath - the package pathannotationClasses - the annotation classesClassNotFoundException - the class not found exceptionIOException - Signals that an I/O exception has occurred.public static <T extends Annotation> T getAnnotation(Class<?> componentClass, Class<T> annotationClass)
T - the generic typecomponentClass - the component classannotationClass - the annotation classpublic static boolean isAnnotationPresentInSuperClasses(Class<?> componentClass, Class<? extends Annotation> annotationClass)
componentClass - the component classannotationClass - the annotation classpublic static boolean isAnnotationPresentInSuperClassesOrInterfaces(Class<?> componentClass, Class<? extends Annotation> annotationClass)
componentClass - the component classannotationClass - the annotation classpublic static Set<Class<?>> scanForAnnotatedClasses(File directory, String packagePath, Class<? extends Annotation> annotationClass) throws ClassNotFoundException
directory - the directorypackagePath - the package pathannotationClass - the annotation classClassNotFoundException - the class not found exceptionpublic static Set<Class<?>> scanForAnnotatedClassesFromSet(File directory, String packagePath, Set<Class<? extends Annotation>> annotationClasses) throws ClassNotFoundException
directory - the directorypackagePath - the package pathannotationClasses - the list with the annotation classesClassNotFoundException - the class not found exceptionpublic static Set<Class<?>> scanForClasses(File directory, String packagePath) throws ClassNotFoundException
directory - the directorypackagePath - the package pathClassNotFoundException - the class not found exceptionCopyright © 2007–2015 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.