Class ClassFilter

  • All Implemented Interfaces:
    java.util.function.Predicate<java.lang.Class<?>>


    @API(status=INTERNAL,
         since="1.1")
    public class ClassFilter
    extends java.lang.Object
    implements java.util.function.Predicate<java.lang.Class<?>>
    Class-related predicate holder used by reflection utilities.

    DISCLAIMER

    These utilities are intended solely for usage within the JUnit framework itself. Any usage by external parties is not supported. Use at your own risk!

    Since:
    1.1
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean match​(java.lang.Class<?> type)
      Test class using the stored class predicate.
      boolean match​(java.lang.String name)
      Test name using the stored name predicate.
      static ClassFilter of​(java.util.function.Predicate<java.lang.Class<?>> classPredicate)
      Create a ClassFilter instance that accepts all names but filters classes.
      static ClassFilter of​(java.util.function.Predicate<java.lang.String> namePredicate, java.util.function.Predicate<java.lang.Class<?>> classPredicate)
      Create a ClassFilter instance that filters by names and classes.
      boolean test​(java.lang.Class<?> type)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.function.Predicate

        and, isEqual, negate, or
    • Method Detail

      • of

        public static ClassFilter of​(java.util.function.Predicate<java.lang.Class<?>> classPredicate)
        Create a ClassFilter instance that accepts all names but filters classes.
      • of

        public static ClassFilter of​(java.util.function.Predicate<java.lang.String> namePredicate,
                                     java.util.function.Predicate<java.lang.Class<?>> classPredicate)
        Create a ClassFilter instance that filters by names and classes.
      • match

        public boolean match​(java.lang.String name)
        Test name using the stored name predicate.
      • match

        public boolean match​(java.lang.Class<?> type)
        Test class using the stored class predicate.
      • test

        public boolean test​(java.lang.Class<?> type)
        Specified by:
        test in interface java.util.function.Predicate<java.lang.Class<?>>
        Implementation Note:
        This implementation combines all tests stored in the predicates of this instance. Any new predicate must be added to this test method as well.