Class ClassFinder

java.lang.Object
net.thucydides.core.reflection.ClassFinder

public class ClassFinder
extends java.lang.Object
Load classes from a given package.
  • Method Summary

    Modifier and Type Method Description
    ClassFinder annotatedWith​(java.lang.Class annotation)  
    java.util.List<java.lang.Class<?>> fromPackage​(java.lang.String packageName)
    Scans all classes accessible from the context class loader which belong to the given package and subpackages.
    static java.util.List<java.lang.Class<?>> getClasses​(java.lang.String packageName)
    Scans all classes accessible from the context class loader which belong to the given package and subpackages.
    static ClassFinder loadClasses()  
    ClassFinder thatImplement​(java.lang.Class<?> parentInterface)  
    ClassFinder thatMatch​(java.util.function.Predicate<java.lang.Class> condition)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • loadClasses

      public static ClassFinder loadClasses()
    • annotatedWith

      public ClassFinder annotatedWith​(java.lang.Class annotation)
    • fromPackage

      public java.util.List<java.lang.Class<?>> fromPackage​(java.lang.String packageName)
      Scans all classes accessible from the context class loader which belong to the given package and subpackages.
      Parameters:
      packageName - The base package
      Returns:
      The classes
    • getClasses

      public static java.util.List<java.lang.Class<?>> getClasses​(java.lang.String packageName)
      Scans all classes accessible from the context class loader which belong to the given package and subpackages. Adapted from http://snippets.dzone.com/posts/show/4831 and extended to support use of JAR files
      Parameters:
      packageName - The base package
      Returns:
      The classes
    • thatImplement

      public ClassFinder thatImplement​(java.lang.Class<?> parentInterface)
    • thatMatch

      public ClassFinder thatMatch​(java.util.function.Predicate<java.lang.Class> condition)