Package net.simplace.core.service
Class ClassFinder
java.lang.Object
net.simplace.core.service.ClassFinder
This utility class was based originally on Daniel Le Berre's
RTSI class. This class can be called in different modes, but the principal use is to determine what subclasses/implementations of a given class/interface exist in the current runtime environment.- Author:
- Daniel Le Berre, Elliott Wade
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanfindResources(String aPackage, String aRegexp) findSubclasses(String aStartsWithFilter, String fqcn) Determine every URL location defined by the current classpath, and it's associated package name.static ClassFinderfinal URLgetLocationOf(Class<?> cls) The result of the last search is cached in this object, along with the URL that corresponds to each class returned.getResources(String pattern) for all elements of java.class.path get a Collection of resources Pattern pattern = Pattern.compile(".*"); gets all resourcesstatic voidfinal voidRescan the classpath, cacheing all possible file locations.
-
Method Details
-
getInstance
- Returns:
- The singleton instance
-
refreshLocations
public final void refreshLocations()Rescan the classpath, cacheing all possible file locations. -
findSubclasses
- Parameters:
aStartsWithFilter-fqcn- Name of superclass/interface on which to search- Returns:
- Vector
-
exists
-
findResources
- Parameters:
aPackage-aRegexp-- Returns:
- a Vector of Resources
-
getErrors
- Returns:
- List of Errors
-
getLocationOf
The result of the last search is cached in this object, along with the URL that corresponds to each class returned. This method may be called to query the cache for the location at which the given class was found.nullwill be returned if the given class was not found during the last search, or if the result cache has been cleared.- Parameters:
cls-- Returns:
- location of the class
-
getClasspathLocations
Determine every URL location defined by the current classpath, and it's associated package name.- Returns:
- Map of URL location defined by the current classpath, and it's associated package name
-
getResources
for all elements of java.class.path get a Collection of resources Pattern pattern = Pattern.compile(".*"); gets all resources- Parameters:
aPackage-pattern- the pattern to match- Returns:
- the resources in the order they are found
-
main
- Parameters:
args-
-