|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.opensymphony.xwork2.util.finder.ClassFinder
public class 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 | |
---|---|
class |
ClassFinder.Annotatable
|
class |
ClassFinder.AnnotationInfo
|
class |
ClassFinder.ClassInfo
|
class |
ClassFinder.FieldInfo
|
static interface |
ClassFinder.Info
|
class |
ClassFinder.InfoBuildingVisitor
|
class |
ClassFinder.MethodInfo
|
class |
ClassFinder.PackageInfo
|
Constructor Summary | |
---|---|
ClassFinder(Class... classes)
|
|
ClassFinder(ClassLoaderInterface classLoader)
Creates a ClassFinder that will search the urls in the specified ClassLoaderInterface excluding the urls in the ClassLoaderInterface's parent. |
|
ClassFinder(ClassLoaderInterface classLoader,
boolean excludeParent)
Creates a ClassFinder that will search the urls in the specified ClassLoaderInterface. |
|
ClassFinder(ClassLoaderInterface classLoader,
ClassLoaderInterface exclude)
Creates a ClassFinder that will search the urls in the specified classloader excluding the urls in the 'exclude' ClassLoaderInterface. |
|
ClassFinder(ClassLoaderInterface classLoaderInterface,
Collection<URL> urls)
|
|
ClassFinder(ClassLoaderInterface classLoaderInterface,
Collection<URL> urls,
boolean extractBaseInterfaces)
|
|
ClassFinder(ClassLoaderInterface classLoaderInterface,
Collection<URL> urls,
boolean extractBaseInterfaces,
Set<String> protocols)
|
|
ClassFinder(ClassLoaderInterface classLoaderInterface,
Collection<URL> urls,
boolean extractBaseInterfaces,
Set<String> protocols,
Test<String> classNameFilter)
|
|
ClassFinder(ClassLoaderInterface classLoader,
String... dirNames)
|
|
ClassFinder(ClassLoaderInterface classLoader,
URL url)
|
|
ClassFinder(List<Class> classes)
|
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> |
findClasses()
|
List<Class> |
findClasses(Test<ClassFinder.ClassInfo> test)
|
List<Class> |
findClassesInPackage(String packageName,
boolean recursive)
|
List<String> |
getClassesNotLoaded()
Returns a list of classes that could not be loaded in last invoked findAnnotated* method. |
boolean |
isAnnotationPresent(Class<? extends Annotation> annotation)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClassFinder(ClassLoaderInterface classLoader) throws Exception
classLoader
- source of classes to scan
Exception
- if something goes wrongpublic ClassFinder(ClassLoaderInterface classLoader, boolean excludeParent) throws Exception
classLoader
- source of classes to scanexcludeParent
- Allegedly excludes classes from parent ClassLoaderInterface, whatever that might mean
Exception
- if something goes wrong.public ClassFinder(ClassLoaderInterface classLoader, ClassLoaderInterface exclude) throws Exception
classLoader
- source of classes to scanexclude
- source of classes to exclude from scanning
Exception
- if something goes wrongpublic 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)
public ClassFinder(ClassLoaderInterface classLoaderInterface, Collection<URL> urls, boolean extractBaseInterfaces, Set<String> protocols, Test<String> classNameFilter)
public ClassFinder(Class... classes)
public ClassFinder(List<Class> classes)
Method Detail |
---|
public boolean isAnnotationPresent(Class<? extends Annotation> annotation)
public List<String> getClassesNotLoaded()
public List<Package> findAnnotatedPackages(Class<? extends Annotation> annotation)
public List<Class> findAnnotatedClasses(Class<? extends Annotation> annotation)
public List<Method> findAnnotatedMethods(Class<? extends Annotation> annotation)
public List<Constructor> findAnnotatedConstructors(Class<? extends Annotation> annotation)
public List<Field> findAnnotatedFields(Class<? extends Annotation> annotation)
public List<Class> findClassesInPackage(String packageName, boolean recursive)
public List<Class> findClasses(Test<ClassFinder.ClassInfo> test)
public List<Class> findClasses()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |