org.apache.openejb.util
Class AnnotationFinder
java.lang.Object
org.apache.openejb.util.AnnotationFinder
public class AnnotationFinder
- extends java.lang.Object
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: 903000 $ $Date: 2010-01-25 23:23:38 +0100 (Mo, 25. Jan 2010) $
- Author:
- David Blevins
Constructor Summary |
AnnotationFinder(java.lang.ClassLoader classLoader)
Creates a ClassFinder that will search the urls in the specified classloader
excluding the urls in the classloader's parent. |
AnnotationFinder(java.lang.ClassLoader classLoader,
boolean excludeParent)
Creates a ClassFinder that will search the urls in the specified classloader. |
AnnotationFinder(java.lang.ClassLoader classLoader,
java.lang.ClassLoader exclude)
Creates a ClassFinder that will search the urls in the specified classloader excluding
the urls in the 'exclude' classloader. |
AnnotationFinder(java.lang.ClassLoader classLoader,
java.util.Collection<java.net.URL> urls)
|
AnnotationFinder(java.lang.ClassLoader classLoader,
java.net.URL url)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
classes
public static int classes
AnnotationFinder
public AnnotationFinder(java.lang.ClassLoader classLoader)
throws java.lang.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:
java.lang.Exception
- if something goes wrong
AnnotationFinder
public AnnotationFinder(java.lang.ClassLoader classLoader,
boolean excludeParent)
throws java.lang.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:
java.lang.Exception
- if something goes wrong.
AnnotationFinder
public AnnotationFinder(java.lang.ClassLoader classLoader,
java.lang.ClassLoader exclude)
throws java.lang.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:
java.lang.Exception
- if something goes wrong
AnnotationFinder
public AnnotationFinder(java.lang.ClassLoader classLoader,
java.net.URL url)
AnnotationFinder
public AnnotationFinder(java.lang.ClassLoader classLoader,
java.util.Collection<java.net.URL> urls)
getClassesNotLoaded
public java.util.List<java.lang.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.
find
public boolean find(AnnotationFinder.Filter filter)
Copyright © 1999-2011 The Apache OpenEJB development community. All Rights Reserved.