com.opensymphony.xwork2.util.finder
Class ClassFinder
java.lang.Object
com.opensymphony.xwork2.util.finder.ClassFinder
public class ClassFinder
- extends Object
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.
- Version:
- $Rev: 1352301 $ $Date: 2012-06-20 22:27:39 +0200 (Wed, 20 Jun 2012) $
- Author:
- David Blevins
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ClassFinder
public ClassFinder(ClassLoaderInterface classLoaderInterface,
Collection<URL> urls,
boolean extractBaseInterfaces,
Set<String> protocols,
Test<String> classNameFilter)
ClassFinder
public ClassFinder(Class... classes)
ClassFinder
public ClassFinder(List<Class> classes)
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)
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)
findClasses
public List<Class> findClasses(Test<ClassFinder.ClassInfo> test)
findClasses
public List<Class> findClasses()
Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.