Save This Page
Home » xwork-2.1.5 » com.opensymphony.xwork2.util.finder » [javadoc | source]
com.opensymphony.xwork2.util.finder
public class: ClassFinder [javadoc | source]
java.lang.Object
   com.opensymphony.xwork2.util.finder.ClassFinder
ClassFinder searches the classpath of the specified ClassLoaderInterface for packages, classes, constructors, methods, or fields with specific annotations. For security reasons ASM is used to find the annotations. Classes are not loaded unless they match the requirements of a called findAnnotated* method. Once loaded, these classes are cached. The getClassesNotLoaded() method can be used immediately after any find* method to get a list of classes which matched the find requirements (i.e. contained the annotation), but were unable to be loaded.
Nested Class Summary:
public class  ClassFinder.Annotatable   
public static interface  ClassFinder.Info   
public class  ClassFinder.PackageInfo   
public class  ClassFinder.ClassInfo   
public class  ClassFinder.MethodInfo   
public class  ClassFinder.FieldInfo   
public class  ClassFinder.AnnotationInfo   
public class  ClassFinder.InfoBuildingVisitor   
Constructor:
 public ClassFinder(ClassLoaderInterface classLoader) throws Exception 
    Creates a ClassFinder that will search the urls in the specified ClassLoaderInterface excluding the urls in the ClassLoaderInterface's parent. To include the parent ClassLoaderInterface, use: new ClassFinder(ClassLoaderInterface, false); To exclude the parent's parent, use: new ClassFinder(ClassLoaderInterface, ClassLoaderInterface.getParent().getParent());
    Parameters:
    classLoader - source of classes to scan
    Throws:
    Exception - if something goes wrong
 public ClassFinder(Class classes) 
 public ClassFinder(List<Class> classes) 
 public ClassFinder(ClassLoaderInterface classLoader,
    boolean excludeParent) throws Exception 
    Creates a ClassFinder that will search the urls in the specified ClassLoaderInterface.
    Parameters:
    classLoader - source of classes to scan
    excludeParent - Allegedly excludes classes from parent ClassLoaderInterface, whatever that might mean
    Throws:
    Exception - if something goes wrong.
 public ClassFinder(ClassLoaderInterface classLoader,
    ClassLoaderInterface exclude) throws Exception 
    Creates a ClassFinder that will search the urls in the specified classloader excluding the urls in the 'exclude' ClassLoaderInterface.
    Parameters:
    classLoader - source of classes to scan
    exclude - source of classes to exclude from scanning
    Throws:
    Exception - if something goes wrong
 public ClassFinder(ClassLoaderInterface classLoader,
    URL url) 
 public ClassFinder(ClassLoaderInterface classLoader,
    String dirNames) 
 public ClassFinder(ClassLoaderInterface classLoaderInterface,
    Collection<URL> urls) 
 public ClassFinder(ClassLoaderInterface classLoaderInterface,
    Collection<URL> urls,
    boolean extractBaseInterfaces) 
 public ClassFinder(ClassLoaderInterface classLoaderInterface,
    Collection<URL> urls,
    boolean extractBaseInterfaces,
    Set<String> protocols) 
Method from com.opensymphony.xwork2.util.finder.ClassFinder Summary:
findAnnotatedClasses,   findAnnotatedConstructors,   findAnnotatedFields,   findAnnotatedMethods,   findAnnotatedPackages,   findClasses,   findClasses,   findClassesInPackage,   getClassesNotLoaded,   isAnnotationPresent
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.opensymphony.xwork2.util.finder.ClassFinder Detail:
 public List<Class> findAnnotatedClasses(Class<Annotation> annotation) 
 public List<Constructor> findAnnotatedConstructors(Class<Annotation> annotation) 
 public List<Field> findAnnotatedFields(Class<Annotation> annotation) 
 public List<Method> findAnnotatedMethods(Class<Annotation> annotation) 
 public List<Package> findAnnotatedPackages(Class<Annotation> annotation) 
 public List<Class> findClasses() 
 public List<Class> findClasses(Test<ClassInfo> test) 
 public List<Class> findClassesInPackage(String packageName,
    boolean recursive) 
 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.

 public boolean isAnnotationPresent(Class<Annotation> annotation)