org.apache.xbean.finder
Class AbstractFinder
java.lang.Object
org.apache.xbean.finder.AbstractFinder
- All Implemented Interfaces:
- IAnnotationFinder
- Direct Known Subclasses:
- BundleAnnotationFinder, ClassFinder
public abstract class AbstractFinder
- extends Object
- implements IAnnotationFinder
- Version:
- $Rev: 1326452 $ $Date: 2012-04-15 17:24:14 -0700 (Sun, 15 Apr 2012) $
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
classInfos
protected final Map<String,AbstractFinder.ClassInfo> classInfos
originalInfos
protected final Map<String,AbstractFinder.ClassInfo> originalInfos
AbstractFinder
public AbstractFinder()
getResource
protected abstract URL getResource(String className)
loadClass
protected abstract Class<?> loadClass(String fixedName)
throws ClassNotFoundException
- Throws:
ClassNotFoundException
getAnnotatedClassNames
public List<String> getAnnotatedClassNames()
- Specified by:
getAnnotatedClassNames in interface IAnnotationFinder
link
public AbstractFinder link()
throws IOException
- The link() method must be called to successfully use the findSubclasses and findImplementations methods
- Returns:
-
- Throws:
IOException
isAnnotationPresent
public boolean isAnnotationPresent(Class<? extends Annotation> annotation)
- Specified by:
isAnnotationPresent in interface IAnnotationFinder
getClassesNotLoaded
public List<String> getClassesNotLoaded()
- Returns a list of classes that could not be loaded in last invoked findAnnotated* method.
The list will only contain entries of classes whose byte code matched the requirements
of last invoked find* method, but were unable to be loaded and included in the results.
The list returned is unmodifiable. Once obtained, the returned list will be a live view of the
results from the last findAnnotated* method call.
This method is not thread safe.
- Specified by:
getClassesNotLoaded in interface IAnnotationFinder
- Returns:
- an unmodifiable live view of classes that could not be loaded in previous findAnnotated* call.
findAnnotatedPackages
public List<Package> findAnnotatedPackages(Class<? extends Annotation> annotation)
- Specified by:
findAnnotatedPackages in interface IAnnotationFinder
findAnnotatedClasses
public List<Class<?>> findAnnotatedClasses(Class<? extends Annotation> annotation)
- Specified by:
findAnnotatedClasses in interface IAnnotationFinder
findMetaAnnotatedClasses
public List<Annotated<Class<?>>> findMetaAnnotatedClasses(Class<? extends Annotation> annotation)
- Specified by:
findMetaAnnotatedClasses in interface IAnnotationFinder
findInheritedAnnotatedClasses
public List<Class<?>> findInheritedAnnotatedClasses(Class<? extends Annotation> annotation)
- Naive implementation - works extremelly slow O(n^3)
- Specified by:
findInheritedAnnotatedClasses in interface IAnnotationFinder
- Parameters:
annotation -
- Returns:
- list of directly or indirectly (inherited) annotated classes
findAnnotatedMethods
public List<Method> findAnnotatedMethods(Class<? extends Annotation> annotation)
- Specified by:
findAnnotatedMethods in interface IAnnotationFinder
findMetaAnnotatedMethods
public List<Annotated<Method>> findMetaAnnotatedMethods(Class<? extends Annotation> annotation)
- Specified by:
findMetaAnnotatedMethods in interface IAnnotationFinder
findAnnotatedConstructors
public List<Constructor> findAnnotatedConstructors(Class<? extends Annotation> annotation)
- Specified by:
findAnnotatedConstructors in interface IAnnotationFinder
findAnnotatedFields
public List<Field> findAnnotatedFields(Class<? extends Annotation> annotation)
- Specified by:
findAnnotatedFields in interface IAnnotationFinder
findMetaAnnotatedFields
public List<Annotated<Field>> findMetaAnnotatedFields(Class<? extends Annotation> annotation)
- Specified by:
findMetaAnnotatedFields in interface IAnnotationFinder
findClassesInPackage
public List<Class<?>> findClassesInPackage(String packageName,
boolean recursive)
- Specified by:
findClassesInPackage in interface IAnnotationFinder
findSubclasses
public <T> List<Class<? extends T>> findSubclasses(Class<T> clazz)
- Specified by:
findSubclasses in interface IAnnotationFinder
findImplementations
public <T> List<Class<? extends T>> findImplementations(Class<T> clazz)
- Specified by:
findImplementations in interface IAnnotationFinder
getAnnotationInfos
protected List<AbstractFinder.Info> getAnnotationInfos(String name)
readClassDef
protected void readClassDef(String className)
readClassDef
protected void readClassDef(InputStream in)
throws IOException
- Throws:
IOException
readClassDef
protected void readClassDef(InputStream in,
String path)
throws IOException
- Throws:
IOException
readClassDef
protected void readClassDef(Class clazz)
Copyright © 1999-2012 The Apache Software Foundation. All Rights Reserved.