java.lang.Object
org.junit.platform.commons.support.scanning.ClassFilter

@API(status=EXPERIMENTAL, since="1.12") public class ClassFilter extends Object
Class-related predicate used by reflection utilities.
Since:
1.1
  • Method Details

    • of

      public static ClassFilter of(Predicate<Class<?>> classPredicate)
      Create a ClassFilter instance that accepts all names but filters classes.
      Parameters:
      classPredicate - the class type predicate; never null
      Returns:
      an instance of ClassFilter; never null
    • of

      public static ClassFilter of(Predicate<String> namePredicate, Predicate<Class<?>> classPredicate)
      Create a ClassFilter instance that filters by names and classes.
      Parameters:
      namePredicate - the class name predicate; never null
      classPredicate - the class type predicate; never null
      Returns:
      an instance of ClassFilter; never null
    • match

      public boolean match(String name)
      Test the given name using the stored name predicate.
      Parameters:
      name - the name to test; never null
      Returns:
      true if the input name matches the predicate, otherwise false
    • match

      public boolean match(Class<?> type)
      Test the given class using the stored class predicate.
      Parameters:
      type - the type to test; never null
      Returns:
      true if the input type matches the predicate, otherwise false