Instantiate a new ClassFinder
that will search the specified
classpath, or the default classpath, if no classpath is defined.
Instantiate a new ClassFinder
that will search the specified
classpath, or the default classpath, if no classpath is defined.
the classpath, which is a sequence of File
objects representing directories, jars and zip files
to search. Defaults to classpath
.
a new ClassFinder
object
Create a map from an Iterator of ClassInfo objects.
Create a map from an Iterator of ClassInfo objects. The resulting map is indexed by class name.
Convenient method for getting the standard JVM classpath, into a
variable suitable for use with the find()
method.
Convenient method for getting the standard JVM classpath, into a
variable suitable for use with the find()
method.
the classpath, as a list of File
objects
Convenience method that scans the specified classes for all concrete classes that are subclasses of the named class.
Convenience method that scans the specified classes for all concrete classes that are subclasses of the named class. A subclass, in this definition, is a class that directly or indirectly (a) implements an interface (if the named class is an interface) or (b) extends a subclass (if the named class is a class). The class must be concrete, so intermediate abstract classes are not returned, though any children of such abstract classes will be.
WARNING: This method can chew up a lot of temporary heap space, if called with a large classpath.
the name of the class for which to find descendent concrete subclasses
the iterator of ClassInfo
objects to search
an iterator of ClassInfo
objects that are concrete subclasses
of ancestor
. The iterator will be empty if no matching classes
could be found.
Convenience method that scans the specified classes for all concrete classes that are subclasses of the named class.
Convenience method that scans the specified classes for all concrete classes that are subclasses of the named class. A subclass, in this definition, is a class that directly or indirectly (a) implements an interface (if the named class is an interface) or (b) extends a subclass (if the named class is a class). The class must be concrete, so intermediate abstract classes are not returned, though any children of such abstract classes will be.
WARNINGS
This method converts the iterator to a map of classes, for easier lookup. Thus, upon its return, the iterator will be empty. You can certainly recreate the iterator, but at a cost. If you need to make multiple calls to this method with the same classpath, consider converting the iterator to a map first, as shown below:
val finder = ClassFinder(myPath) val classes = finder.getClasses // classes is an Iterator[ClassInfo] val classMap = ClassFinder.classInfoMap // runs the iterator out, once val foos = ClassFinder.concreteSubclasses("org.example.Foo", classMap) val bars = ClassFinder.concreteSubclasses("org.example.Bar", classMap)
This method can chew up a lot of temporary heap space, if called with a large classpath.
the name of the class for which to find descendent concrete subclasses
the iterator of ClassInfo
objects to search
an iterator of ClassInfo
objects that are concrete subclasses
of ancestor
. The iterator will be empty if no matching classes
could be found.
The entrance to the factory floor, providing methods for finding and filtering classes.