Object/Class

org.clapper.classutil

ClassFinder

Related Docs: class ClassFinder | package classutil

Permalink

object ClassFinder

The entrance to the factory floor, providing methods for finding and filtering classes.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ClassFinder
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def apply(path: Seq[File] = Seq.empty[File], maybeOverrideAsmVersion: Option[Int] = None): ClassFinder

    Permalink

    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.

    path

    the classpath, which is a sequence of File objects representing directories, jars and zip files to search. Defaults to classpath if empty.

    maybeOverrideAsmVersion

    the version of asm to be used. Defaults to v6. To override use one of the ASM-fields in org.objectweb.asm.Opcodes (e.g., (org.objectweb.asm.Opcodes.ASM5).

    returns

    a new ClassFinder object

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def classInfoMap(stream: LazyList[ClassInfo]): Map[String, ClassInfo]

    Permalink

    Create a map from a Stream of ClassInfo objects.

    Create a map from a Stream of ClassInfo objects. The resulting map is indexed by class name.

    returns

    a map of (classname, ClassInfo) pairs

  7. def classInfoMap(iterator: Iterator[ClassInfo]): Map[String, ClassInfo]

    Permalink

    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.

    returns

    a map of (classname, ClassInfo) pairs

  8. def classpath: List[File]

    Permalink

    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.

    returns

    the classpath, as a list of File objects

  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def concreteSubclasses(ancestor: String, classes: Map[String, ClassInfo]): Iterator[ClassInfo]

    Permalink

    Variant of concreteSubclasses() that takes a string class name and a map, rather than a Class and a map.

    Variant of concreteSubclasses() that takes a string class name and a map, rather than a Class and a map.

    ancestor

    the name of the class for which to find descendent concrete subclasses

    classes

    the iterator of ClassInfo objects to search

    returns

    an iterator of ClassInfo objects that are concrete subclasses of ancestor. The iterator will be empty if no matching classes could be found.

    See also

    concreteSubclasses(String, Iterator[ClassInfo])

    concreteSubclasses(String, Stream[ClassInfo])

    concreteSubclasses(Class[_], Map[String, ClassInfo])

  11. def concreteSubclasses(ancestor: Class[_], classes: Map[String, ClassInfo]): Iterator[ClassInfo]

    Permalink

    Variant of concreteSubclasses() that takes a class and a Map ClassInfo objects.

    Variant of concreteSubclasses() that takes a class and a Map ClassInfo objects.

    ancestor

    the Class object of the superclass or trait for which to find descendent concrete subclasses

    classes

    the iterator of ClassInfo objects to search

    returns

    an iterator of ClassInfo objects that are concrete subclasses of ancestor. The iterator will be empty if no matching classes could be found.

    See also

    concreteSubclasses(Class[_], Iterator[ClassInfo])

    concreteSubclasses(Class[_], Stream[ClassInfo])

  12. def concreteSubclasses(ancestor: String, classes: Iterator[ClassInfo]): Iterator[ClassInfo]

    Permalink

    Variant of concreteSubclasses() that takes a string class name and an Iterator of ClassInfo objects, rather than a Class and an Iterator.

    Variant of concreteSubclasses() that takes a string class name and an Iterator of ClassInfo objects, rather than a Class and an Iterator.

    ancestor

    the name of the class for which to find descendent concrete subclasses

    classes

    the stream of ClassInfo objects to search

    returns

    an iterator of ClassInfo objects that are concrete subclasses of ancestor. The iterator will be empty if no matching classes could be found.

    Example:
    1. val finder = ClassFinder(myPath)
      val classes = finder.getClasses  // classes is an Stream[ClassInfo]
      // Of course, it's easier just to call the version that takes a
      // Stream...
      ClassFinder.concreteSubclasses("org.example.Foo", classes.iterator)
    See also

    concreteSubclasses(Class[_], Iterator[ClassInfo])

    concreteSubclasses(String, Stream[ClassInfo])

  13. def concreteSubclasses(ancestor: Class[_], classes: Iterator[ClassInfo]): Iterator[ClassInfo]

    Permalink

    Variant of concreteSubclasses() that takes a class and an Iterator of ClassInfo objects, rather than a Class and a Stream.

    Variant of concreteSubclasses() that takes a class and an Iterator of ClassInfo objects, rather than a Class and a Stream.

    ancestor

    the Class object of the superclass or trait for which to find descendent concrete subclasses

    classes

    the iterator of ClassInfo objects to search

    returns

    an iterator of ClassInfo objects that are concrete subclasses of ancestor. The iterator will be empty if no matching classes could be found.

    Example:
    1. val finder = ClassFinder(myPath)
      val classes = finder.getClasses  // classes is an Stream[ClassInfo]
      // Of course, it's easier just to call the version that takes a
      // Stream...
      ClassFinder.concreteSubclasses(classOf[Baz], classes.iterator)
    See also

    concreteSubclasses(Class[_], Stream[ClassInfo])

  14. def concreteSubclasses(ancestor: String, classes: LazyList[ClassInfo]): Iterator[ClassInfo]

    Permalink

    Variant of concreteSubclasses() that takes a string class name and a Stream of ClassInfo objects, rather than a Class and a Stream.

    Variant of concreteSubclasses() that takes a string class name and a Stream of ClassInfo objects, rather than a Class and a Stream.

    ancestor

    the name of the class for which to find descendent concrete subclasses

    classes

    the LazyList of ClassInfo objects to search. (Note that in versions of Scala prior to 2.13.0, this lazy list should really be a Stream. A compatibility type definition within this library ensures that methods returning LazyList really return Stream, in that case.)

    returns

    an iterator of ClassInfo objects that are concrete subclasses of ancestor. The iterator will be empty if no matching classes could be found.

    See also

    concreteSubclasses(Class[_], Stream[ClassInfo])

  15. def concreteSubclasses(ancestor: Class[_], classes: LazyList[ClassInfo]): Iterator[ClassInfo]

    Permalink

    Convenience method that scans the specified classes for all concrete classes that are subclasses of a superclass or trait.

    Convenience method that scans the specified classes for all concrete classes that are subclasses of a superclass or trait. 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 stream to a map of classes, for easier lookup. Thus, upon its return, the stream will be empty. You can certainly recreate the stream, but at a cost. If you need to make multiple calls to this method with the same classpath, consider converting the stream to a map first, as shown below:

    val finder = ClassFinder(myPath)
    val classes = finder.getClasses  // classes is an Stream[ClassInfo]
    val classMap = ClassFinder.classInfoMap // runs the stream out, once
    val foos = ClassFinder.concreteSubclasses(classOf[org.example.Foo], classMap)
    val bars = ClassFinder.concreteSubclasses(classOf[Bar], classMap)

    This method can chew up a lot of temporary heap space, if called with a large classpath.

    ancestor

    the Class object of the superclass or trait for which to find descendent concrete subclasses

    classes

    the LazyList of ClassInfo objects to search. (Note that in versions of Scala prior to 2.13.0, this lazy list should really be a Stream. A compatibility type definition within this library ensures that methods returning LazyList really return Stream, in that case.)

    returns

    an iterator of ClassInfo objects that are concrete subclasses of ancestor. The iterator will be empty if no matching classes could be found.

  16. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  18. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  20. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  21. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  22. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  23. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  25. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  26. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  27. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped