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 java.lang.Object

Version:
$Rev: 924423 $ $Date: 2010-03-17 20:06:14 +0100 (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  java.util.List<AbstractFinder.ClassInfo> classInfos
           
 
Constructor Summary
AbstractFinder()
           
 
Method Summary
 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)
           
 java.util.List<java.lang.Class> findInheritedAnnotatedClasses(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
          Naive implementation - works extremelly slow O(n^3)
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)
           
protected abstract  java.lang.Class<?> loadClass(java.lang.String fixedName)
           
protected  void readClassDef(java.io.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 java.util.List<AbstractFinder.ClassInfo> classInfos
Constructor Detail

AbstractFinder

public AbstractFinder()
Method Detail

getResource

protected abstract java.net.URL getResource(java.lang.String className)

loadClass

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

isAnnotationPresent

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

getClassesNotLoaded

public java.util.List<java.lang.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 java.util.List<java.lang.Package> findAnnotatedPackages(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)

findAnnotatedClasses

public java.util.List<java.lang.Class> findAnnotatedClasses(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)

findInheritedAnnotatedClasses

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

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

findAnnotatedMethods

public java.util.List<java.lang.reflect.Method> findAnnotatedMethods(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)

findAnnotatedConstructors

public java.util.List<java.lang.reflect.Constructor> findAnnotatedConstructors(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)

findAnnotatedFields

public java.util.List<java.lang.reflect.Field> findAnnotatedFields(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)

findClassesInPackage

public java.util.List<java.lang.Class> findClassesInPackage(java.lang.String packageName,
                                                            boolean recursive)

getAnnotationInfos

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

readClassDef

protected void readClassDef(java.io.InputStream in)
                     throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2005-2011. All Rights Reserved.