public abstract class AbstractFinder extends java.lang.Object implements IAnnotationFinder
Modifier and Type | Class and Description |
---|---|
class |
AbstractFinder.Annotatable |
class |
AbstractFinder.AnnotationInfo |
class |
AbstractFinder.ClassInfo |
class |
AbstractFinder.FieldInfo |
static interface |
AbstractFinder.Info |
class |
AbstractFinder.InfoBuildingVisitor |
class |
AbstractFinder.MethodInfo |
class |
AbstractFinder.PackageInfo |
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,java.util.List<AbstractFinder.Info>> |
annotated |
private int |
ASM_FLAGS |
private java.util.List<java.lang.String> |
classesNotLoaded |
protected java.util.Map<java.lang.String,AbstractFinder.ClassInfo> |
classInfos |
protected java.util.Map<java.lang.String,AbstractFinder.ClassInfo> |
originalInfos |
Constructor and Description |
---|
AbstractFinder() |
Modifier and Type | Method and Description |
---|---|
private <T> java.util.List<java.lang.Class<? extends T>> |
_findSubclasses(java.lang.Class<T> clazz) |
private java.util.List<AbstractFinder.ClassInfo> |
collectImplementations(java.lang.String interfaceName) |
java.util.List<java.lang.Class<?>> |
findAnnotatedClasses(java.lang.Class<? extends java.lang.annotation.Annotation> annotation) |
java.util.List<java.lang.reflect.Constructor> |
findAnnotatedConstructors(java.lang.Class<? extends java.lang.annotation.Annotation> annotation) |
java.util.List<java.lang.reflect.Field> |
findAnnotatedFields(java.lang.Class<? extends java.lang.annotation.Annotation> annotation) |
java.util.List<java.lang.reflect.Method> |
findAnnotatedMethods(java.lang.Class<? extends java.lang.annotation.Annotation> annotation) |
java.util.List<java.lang.Package> |
findAnnotatedPackages(java.lang.Class<? extends java.lang.annotation.Annotation> annotation) |
java.util.List<java.lang.Class<?>> |
findClassesInPackage(java.lang.String packageName,
boolean recursive) |
<T> java.util.List<java.lang.Class<? extends T>> |
findImplementations(java.lang.Class<T> clazz) |
java.util.List<java.lang.Class<?>> |
findInheritedAnnotatedClasses(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
Naive implementation - works extremelly slow O(n^3)
|
java.util.List<Annotated<java.lang.Class<?>>> |
findMetaAnnotatedClasses(java.lang.Class<? extends java.lang.annotation.Annotation> annotation) |
java.util.List<Annotated<java.lang.reflect.Field>> |
findMetaAnnotatedFields(java.lang.Class<? extends java.lang.annotation.Annotation> annotation) |
java.util.List<Annotated<java.lang.reflect.Method>> |
findMetaAnnotatedMethods(java.lang.Class<? extends java.lang.annotation.Annotation> annotation) |
private <T> void |
findSubclasses(AbstractFinder.ClassInfo classInfo,
java.util.List<java.lang.Class<? extends T>> found,
java.lang.Class<T> clazz) |
<T> java.util.List<java.lang.Class<? extends T>> |
findSubclasses(java.lang.Class<T> clazz) |
java.util.List<java.lang.String> |
getAnnotatedClassNames() |
protected java.util.List<AbstractFinder.Info> |
getAnnotationInfos(java.lang.String name) |
java.util.List<java.lang.String> |
getClassesNotLoaded()
Returns a list of classes that could not be loaded in last invoked findAnnotated* method.
|
protected abstract java.net.URL |
getResource(java.lang.String className) |
boolean |
isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotation) |
AbstractFinder |
link()
The link() method must be called to successfully use the findSubclasses and findImplementations methods
|
private void |
linkInterfaces(AbstractFinder.ClassInfo classInfo) |
private void |
linkParent(AbstractFinder.ClassInfo classInfo) |
protected abstract java.lang.Class<?> |
loadClass(java.lang.String fixedName) |
protected void |
readClassDef(java.lang.Class clazz) |
protected void |
readClassDef(java.io.InputStream in) |
protected void |
readClassDef(java.io.InputStream in,
java.lang.String path) |
protected void |
readClassDef(java.lang.String className) |
private final java.util.Map<java.lang.String,java.util.List<AbstractFinder.Info>> annotated
protected final java.util.Map<java.lang.String,AbstractFinder.ClassInfo> classInfos
protected final java.util.Map<java.lang.String,AbstractFinder.ClassInfo> originalInfos
private final java.util.List<java.lang.String> classesNotLoaded
private final int ASM_FLAGS
protected abstract java.net.URL getResource(java.lang.String className)
protected abstract java.lang.Class<?> loadClass(java.lang.String fixedName) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public java.util.List<java.lang.String> getAnnotatedClassNames()
getAnnotatedClassNames
in interface IAnnotationFinder
public AbstractFinder link() throws java.io.IOException
java.io.IOException
private void linkParent(AbstractFinder.ClassInfo classInfo) throws java.io.IOException
java.io.IOException
private void linkInterfaces(AbstractFinder.ClassInfo classInfo) throws java.io.IOException
java.io.IOException
public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
isAnnotationPresent
in interface IAnnotationFinder
public java.util.List<java.lang.String> getClassesNotLoaded()
getClassesNotLoaded
in interface IAnnotationFinder
public java.util.List<java.lang.Package> findAnnotatedPackages(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
findAnnotatedPackages
in interface IAnnotationFinder
public java.util.List<java.lang.Class<?>> findAnnotatedClasses(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
findAnnotatedClasses
in interface IAnnotationFinder
public java.util.List<Annotated<java.lang.Class<?>>> findMetaAnnotatedClasses(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
findMetaAnnotatedClasses
in interface IAnnotationFinder
public java.util.List<java.lang.Class<?>> findInheritedAnnotatedClasses(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
findInheritedAnnotatedClasses
in interface IAnnotationFinder
annotation
- public java.util.List<java.lang.reflect.Method> findAnnotatedMethods(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
findAnnotatedMethods
in interface IAnnotationFinder
public java.util.List<Annotated<java.lang.reflect.Method>> findMetaAnnotatedMethods(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
findMetaAnnotatedMethods
in interface IAnnotationFinder
public java.util.List<java.lang.reflect.Constructor> findAnnotatedConstructors(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
findAnnotatedConstructors
in interface IAnnotationFinder
public java.util.List<java.lang.reflect.Field> findAnnotatedFields(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
findAnnotatedFields
in interface IAnnotationFinder
public java.util.List<Annotated<java.lang.reflect.Field>> findMetaAnnotatedFields(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
findMetaAnnotatedFields
in interface IAnnotationFinder
public java.util.List<java.lang.Class<?>> findClassesInPackage(java.lang.String packageName, boolean recursive)
findClassesInPackage
in interface IAnnotationFinder
public <T> java.util.List<java.lang.Class<? extends T>> findSubclasses(java.lang.Class<T> clazz)
findSubclasses
in interface IAnnotationFinder
private <T> void findSubclasses(AbstractFinder.ClassInfo classInfo, java.util.List<java.lang.Class<? extends T>> found, java.lang.Class<T> clazz)
private <T> java.util.List<java.lang.Class<? extends T>> _findSubclasses(java.lang.Class<T> clazz)
public <T> java.util.List<java.lang.Class<? extends T>> findImplementations(java.lang.Class<T> clazz)
findImplementations
in interface IAnnotationFinder
private java.util.List<AbstractFinder.ClassInfo> collectImplementations(java.lang.String interfaceName)
protected java.util.List<AbstractFinder.Info> getAnnotationInfos(java.lang.String name)
protected void readClassDef(java.lang.String className)
protected void readClassDef(java.io.InputStream in) throws java.io.IOException
java.io.IOException
protected void readClassDef(java.io.InputStream in, java.lang.String path) throws java.io.IOException
java.io.IOException
protected void readClassDef(java.lang.Class clazz)