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.ocpsoft.logging.Logger |
log
Common logger for all implementations
|
protected PackageFilter |
packageFilter
The filter for checking which classes to process
|
protected javax.servlet.ServletContext |
servletContext
The
ServletContext |
| Constructor and Description |
|---|
AbstractClassFinder(javax.servlet.ServletContext servletContext,
ClassLoader classLoader,
PackageFilter packageFilter,
ByteCodeFilter byteCodeFilter)
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,
ClassVisitor visitor)
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.ocpsoft.logging.Logger log
protected final javax.servlet.ServletContext servletContext
ServletContextprotected final ClassLoader classLoader
ClassLoader to get classes fromprotected final PackageFilter packageFilter
public AbstractClassFinder(javax.servlet.ServletContext servletContext,
ClassLoader classLoader,
PackageFilter packageFilter,
ByteCodeFilter byteCodeFilter)
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, ClassVisitor visitor)
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 ByteCodeFilter. If no InputStream is
supplied, this check will be skipped. After that the method will create an instance of the class and then call
ClassVisitor#visit(Class, org.ocpsoft.prettyfaces.annotation.PrettyConfig).
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)visitor - the visitorCopyright © 2023 OCPsoft. All rights reserved.