org.apache.xbean.finder
Class AbstractFinder

java.lang.Object
  extended by org.apache.xbean.finder.AbstractFinder
Direct Known Subclasses:
BundleAnnotationFinder, ClassFinder

public abstract class AbstractFinder
extends Object

Version:
$Rev: 924423 $ $Date: 2010-03-17 15:06:14 -0400 (Wed, 17 Mar 2010) $

Nested Class Summary
 class AbstractFinder.Annotatable
           
 class AbstractFinder.AnnotationInfo
           
 class AbstractFinder.ClassInfo
           
 class AbstractFinder.FieldInfo
           
static class AbstractFinder.GenericAwareInfoBuildingVisitor
           
static interface AbstractFinder.Info
           
 class AbstractFinder.InfoBuildingVisitor
           
 class AbstractFinder.MethodInfo
           
 class AbstractFinder.PackageInfo
           
 
Field Summary
protected  List<AbstractFinder.ClassInfo> classInfos
           
 
Constructor Summary
AbstractFinder()
           
 
Method Summary
 List<Class> findAnnotatedClasses(Class<? extends Annotation> annotation)
           
 List<Constructor> findAnnotatedConstructors(Class<? extends Annotation> annotation)
           
 List<Field> findAnnotatedFields(Class<? extends Annotation> annotation)
           
 List<Method> findAnnotatedMethods(Class<? extends Annotation> annotation)
           
 List<Package> findAnnotatedPackages(Class<? extends Annotation> annotation)
           
 List<Class> findClassesInPackage(String packageName, boolean recursive)
           
 List<Class> findInheritedAnnotatedClasses(Class<? extends Annotation> annotation)
          Naive implementation - works extremelly slow O(n^3)
protected  List<AbstractFinder.Info> getAnnotationInfos(String name)
           
 List<String> getClassesNotLoaded()
          Returns a list of classes that could not be loaded in last invoked findAnnotated* method.
protected abstract  URL getResource(String className)
           
 boolean isAnnotationPresent(Class<? extends Annotation> annotation)
           
protected abstract  Class<?> loadClass(String fixedName)
           
protected  void readClassDef(InputStream in)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classInfos

protected final List<AbstractFinder.ClassInfo> classInfos
Constructor Detail

AbstractFinder

public AbstractFinder()
Method Detail

getResource

protected abstract URL getResource(String className)

loadClass

protected abstract Class<?> loadClass(String fixedName)
                               throws ClassNotFoundException
Throws:
ClassNotFoundException

isAnnotationPresent

public boolean isAnnotationPresent(Class<? extends Annotation> annotation)

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.

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)

findAnnotatedClasses

public List<Class> findAnnotatedClasses(Class<? extends Annotation> annotation)

findInheritedAnnotatedClasses

public List<Class> findInheritedAnnotatedClasses(Class<? extends Annotation> annotation)
Naive implementation - works extremelly slow O(n^3)

Parameters:
annotation -
Returns:
list of directly or indirectly (inherited) annotated classes

findAnnotatedMethods

public List<Method> findAnnotatedMethods(Class<? extends Annotation> annotation)

findAnnotatedConstructors

public List<Constructor> findAnnotatedConstructors(Class<? extends Annotation> annotation)

findAnnotatedFields

public List<Field> findAnnotatedFields(Class<? extends Annotation> annotation)

findClassesInPackage

public List<Class> findClassesInPackage(String packageName,
                                        boolean recursive)

getAnnotationInfos

protected List<AbstractFinder.Info> getAnnotationInfos(String name)

readClassDef

protected void readClassDef(InputStream in)
                     throws IOException
Throws:
IOException


Copyright © 2005-2013. All Rights Reserved.