|
InterfaceClassFinder V1.0 by Matthew Ford 2009/01/06 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectau.com.forward.interfaceClassFinder.ClasspathScanner<T>
public class ClasspathScanner<T extends IClasspathProcessor>
This class scans the classpath and calls each consumer for each class found.
Field Summary | |
---|---|
protected java.util.concurrent.ConcurrentLinkedQueue<T> |
consumers
|
static java.lang.String |
DOT_CLASS
|
Constructor Summary | |
---|---|
ClasspathScanner()
|
Method Summary | |
---|---|
void |
addConsumer(T consumer)
Add a consumer to be called for each class found. |
protected void |
callConsumers(java.lang.String className,
java.util.jar.JarEntry jarEntry,
java.io.File jarFile)
Call all consumers for this jar file entry. Note: the consumer must open the file and find the jarEntry passed in. |
protected void |
callConsumers(java.lang.String className,
java.lang.String rootDir,
java.io.File classFile)
Call all consumers for this class file. |
T[] |
getConsumers()
Return an array of all the current consumers registered with this scanner. Changes to this array does not add or remove consumers. |
static void |
main(java.lang.String[] args)
Main class that list all the classes on the classpath and looks for duplicates. |
protected void |
processFileDir(java.io.File f,
java.lang.String packagePath,
java.lang.String rootDir)
Process a file or directory. |
protected void |
processJarFile(java.io.File f)
Scan the jar file for .class files to check |
boolean |
removeConsumer(T consumer)
Remove a consumer. |
void |
scanClassPath()
Scan the classpath and calls the registered consumers for each class found. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DOT_CLASS
protected java.util.concurrent.ConcurrentLinkedQueue<T extends IClasspathProcessor> consumers
Constructor Detail |
---|
public ClasspathScanner()
Method Detail |
---|
public void addConsumer(T consumer)
consumer
- the consumer to addpublic boolean removeConsumer(T consumer)
consumer
- the consumer to remove (as determined by .equals() )
public T[] getConsumers()
public void scanClassPath()
protected void processJarFile(java.io.File f)
f
- the jar file to scanprotected void processFileDir(java.io.File f, java.lang.String packagePath, java.lang.String rootDir)
f
- the file or directory to processpackagePath
- the current package namerootDir
- the root directorytop
- true if this is the top of the package.protected void callConsumers(java.lang.String className, java.lang.String rootDir, java.io.File classFile)
className
- the class namerootDir
- the root directoryclassFile
- the class fileprotected void callConsumers(java.lang.String className, java.util.jar.JarEntry jarEntry, java.io.File jarFile)
className
- the class namejarEntry
- the jar entryjarFile
- the jar filepublic static void main(java.lang.String[] args)
args
- ignored
|
©2003-2009, Forward Computing and Control Pty. Ltd ACN 003 669 994 NSW Australia All Rights Reserved. |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |