public abstract class AbstractClassFinder extends Object implements ClassFinder
ClassFinder interface.ClassFinder| Modifier and Type | Field and Description |
|---|---|
protected ClassLoader |
classLoader
The
ClassLoader to get classes from |
protected org.apache.commons.logging.Log |
log
Common logger for all implementations
|
protected PackageFilter |
packageFilter
The filter for checking which classes to process
|
protected ServletContext |
servletContext
The
ServletContext |
| Constructor and Description |
|---|
AbstractClassFinder(ServletContext servletContext,
ClassLoader classLoader,
PackageFilter packageFilter)
Initialization procedure
|
| Modifier and Type | Method and Description |
|---|---|
protected static String |
getClassName(String filename)
Creates a FQCN from an
URL representing a .class
file. |
protected boolean |
mustProcessClass(String className)
Checks if a supplied class has to be processed by checking the package
name against the
PackageFilter. |
protected void |
processClass(String className,
InputStream classFileStream,
PrettyAnnotationHandler handler)
Handle a single class to process.
|
protected String |
stripKnownPrefix(String str,
String prefix)
Strip everything up to and including a given prefix from a string.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfindClassesprotected final org.apache.commons.logging.Log log
protected final ServletContext servletContext
ServletContextprotected final ClassLoader classLoader
ClassLoader to get classes fromprotected final PackageFilter packageFilter
public AbstractClassFinder(ServletContext servletContext, ClassLoader classLoader, PackageFilter packageFilter)
servletContext - The ServletContext of the web application.classLoader - The ClassLoader to use for loading classespackageFilter - The PackageFilter used to check if a package has to be
scanned.protected String stripKnownPrefix(String str, String prefix)
str - The string to processprefix - The prefixnull if the prefix has not
been foundprotected static String getClassName(String filename)
Creates a FQCN from an URL representing a .class
file.
url - The path of the class fileprotected boolean mustProcessClass(String className)
PackageFilter.className - FQCN of the classtrue for classes to process, false for
classes to ignoreprotected void processClass(String className, InputStream classFileStream, PrettyAnnotationHandler handler)
Handle a single class to process. This method should only be called if the
class name is accepted by the PackageFilter.
If classFileStream is not null the method will first
try to check whether the class files may contain annotations by scanning
it with the ByteCodeAnnotationFilter. If no InputStream is
supplied, this check will be skipped. After that the method will create an
instance of the class and then call
PrettyAnnotationHandler.processClass(Class).
Please not the the called of this method is responsible to close the
supplied InputStream!
className - The FQCN of the classclassFileStream - The Java class file of the class (may be null)handler - the handler to notifyCopyright © 2013 OCPsoft. All Rights Reserved.