Package org.apache.xbean.finder
Class ClassFinder
java.lang.Object
org.apache.xbean.finder.AbstractFinder
org.apache.xbean.finder.ClassFinder
- All Implemented Interfaces:
IAnnotationFinder
ClassFinder searches the classpath of the specified classloader 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: 1393346 $ $Date: 2012-10-03 10:38:26 +0200 (Wed, 03 Oct 2012) $
- Author:
- David Blevins
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.xbean.finder.AbstractFinder
AbstractFinder.Annotatable, AbstractFinder.AnnotationInfo, AbstractFinder.ClassInfo, AbstractFinder.FieldInfo, AbstractFinder.GenericAwareInfoBuildingVisitor, AbstractFinder.Info, AbstractFinder.InfoBuildingVisitor, AbstractFinder.MethodInfo, AbstractFinder.PackageInfo
-
Field Summary
Fields inherited from class org.apache.xbean.finder.AbstractFinder
classInfos, originalInfos
-
Constructor Summary
ConstructorsConstructorDescriptionClassFinder
(Class<?>... classes) ClassFinder
(ClassLoader classLoader) Creates a ClassFinder that will search the urls in the specified classloader excluding the urls in the classloader's parent.ClassFinder
(ClassLoader classLoader, boolean excludeParent) Creates a ClassFinder that will search the urls in the specified classloader.ClassFinder
(ClassLoader classLoader, ClassLoader exclude) Creates a ClassFinder that will search the urls in the specified classloader excluding the urls in the 'exclude' classloader.ClassFinder
(ClassLoader classLoader, URL url) ClassFinder
(ClassLoader classLoader, Collection<URL> urls) ClassFinder
(List<Class<?>> classes) -
Method Summary
Methods inherited from class org.apache.xbean.finder.AbstractFinder
findAnnotatedClasses, findAnnotatedConstructors, findAnnotatedFields, findAnnotatedMethods, findAnnotatedPackages, findClassesInPackage, findImplementations, findInheritedAnnotatedClasses, findMetaAnnotatedClasses, findMetaAnnotatedFields, findMetaAnnotatedMethods, findSubclasses, getAnnotatedClassNames, getAnnotationInfos, getClassesNotLoaded, isAnnotationPresent, link, readClassDef, readClassDef, readClassDef, readClassDef
-
Constructor Details
-
ClassFinder
Creates a ClassFinder that will search the urls in the specified classloader excluding the urls in the classloader's parent. To include the parent classloader, use: new ClassFinder(classLoader, false); To exclude the parent's parent, use: new ClassFinder(classLoader, classLoader.getParent().getParent());- Parameters:
classLoader
- source of classes to scan- Throws:
Exception
- if something goes wrong
-
ClassFinder
Creates a ClassFinder that will search the urls in the specified classloader.- Parameters:
classLoader
- source of classes to scanexcludeParent
- Allegedly excludes classes from parent classloader, whatever that might mean- Throws:
Exception
- if something goes wrong.
-
ClassFinder
Creates a ClassFinder that will search the urls in the specified classloader excluding the urls in the 'exclude' classloader.- Parameters:
classLoader
- source of classes to scanexclude
- source of classes to exclude from scanning- Throws:
Exception
- if something goes wrong
-
ClassFinder
-
ClassFinder
-
ClassFinder
-
ClassFinder
-
-
Method Details
-
getResource
- Specified by:
getResource
in classAbstractFinder
-
loadClass
- Specified by:
loadClass
in classAbstractFinder
- Throws:
ClassNotFoundException
-