org.apache.xbean.finder
Class ClassFinder
java.lang.Object
org.apache.xbean.finder.AbstractFinder
org.apache.xbean.finder.ClassFinder
- All Implemented Interfaces:
- IAnnotationFinder
public class ClassFinder
- extends AbstractFinder
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: 1064425 $ $Date: 2011-01-27 18:13:40 -0800 (Thu, 27 Jan 2011) $
- Author:
- David Blevins
| 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 |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ClassFinder
public ClassFinder(ClassLoader classLoader)
throws Exception
- 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
public ClassFinder(ClassLoader classLoader,
boolean excludeParent)
throws Exception
- 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
public ClassFinder(ClassLoader classLoader,
ClassLoader exclude)
throws Exception
- 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
public ClassFinder(ClassLoader classLoader,
URL url)
ClassFinder
public ClassFinder(ClassLoader classLoader,
Collection<URL> urls)
ClassFinder
public ClassFinder(Class<?>... classes)
ClassFinder
public ClassFinder(List<Class<?>> classes)
getResource
protected URL getResource(String className)
- Specified by:
getResource in class AbstractFinder
loadClass
protected Class<?> loadClass(String fixedName)
throws ClassNotFoundException
- Specified by:
loadClass in class AbstractFinder
- Throws:
ClassNotFoundException
Copyright © 1999-2012 The Apache Software Foundation. All Rights Reserved.