|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.sape.carbon.core.util.reflection.ClassFinder
This class implements the capability to search over the current classpath retrieving classes that implement a certain interface.
Copyright 2001 Sapient
Field Summary | |
protected Set |
classes
The set of classes found matching the provided criteria. |
protected long |
foundClasses
Tracks the count of classes found that match the provided criteria. |
protected String |
requiredPathSubstring
The required substring path criteria for this searcher |
protected Class |
superClass
The super class criteria |
Constructor Summary | |
ClassFinder()
Instantiates the type of MBeanHarvester that will return all classes in the entire classpath. |
|
ClassFinder(Class superClass)
Instantiates the type of MBeanHarvester that will return all classes that are assignable to the supplied class. |
|
ClassFinder(Class superClass,
String requiredPathSubstring)
Instantiates the type of MBeanHarvester that will return all classes that are assignable to the supplied class and are part of the supplied package. |
Method Summary | |
protected void |
addClassName(String className)
Adds a class name to the list of found classes if and only if it meets the configured requirements. |
Set |
getClasses()
Used to retrieve the results Set from this harvester's
search. |
protected String |
getClassName(String fileName)
Returns the Fully Qualified Class name of a class from it's path |
protected boolean |
isArchive(String name)
Looks at the name of a file to determine if it is an archive |
private void |
processFile(String base,
String current)
Recursively search through Directories with special checks to recognize zip and jar files. |
protected void |
processZip(ZipFile file)
Iterates through the files in a zip looking for files that may be classes. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected long foundClasses
protected Class superClass
protected String requiredPathSubstring
protected Set classes
Constructor Detail |
public ClassFinder()
Instantiates the type of MBeanHarvester that will return all classes in the entire classpath.
public ClassFinder(Class superClass)
Instantiates the type of MBeanHarvester that will return all classes that are assignable to the supplied class. This would include all implementations of it, if it is an interface or it and all subclasses of it if it's a class.
superClass
- the Class that should be searched for along with
implementations and subclassespublic ClassFinder(Class superClass, String requiredPathSubstring)
Instantiates the type of MBeanHarvester that will return all classes
that are assignable to the supplied class and are part of the supplied
package. This would include all implementations of it, if it is an
interface or it and all subclasses of it if it's a class. The
supplied requiredPathSubstring must be part of the fully
qualified classname.
superClass
- the Class that should be searched for along with
implementations and subclassesrequiredPathSubstring
- the String part that must be found in the
classes FQNMethod Detail |
protected void addClassName(String className)
Adds a class name to the list of found classes if and only if it meets the configured requirements.
className
- the FQN String name of the class to addpublic Set getClasses()
Used to retrieve the results Set
from this harvester's
search.
private void processFile(String base, String current)
base
- the base file path to searchcurrent
- the current recursively searched file path being searchedprotected boolean isArchive(String name)
Looks at the name of a file to determine if it is an archive
name
- the name of a file
protected String getClassName(String fileName)
Returns the Fully Qualified Class name of a class from it's path
fileName
- the full path to a class
protected void processZip(ZipFile file)
Iterates through the files in a zip looking for files that may be classes. This is not recursive as zip's in zip's are not searched by the classloader either.
file
- The ZipFile to be searched
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |