Class ClassFilter


  • @API(status=MAINTAINED,
         since="1.13.3")
    public class ClassFilter
    extends java.lang.Object
    Class-related predicate used by reflection utilities.
    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 the given class using the stored class predicate.
      boolean match​(java.lang.String name)
      Test the given 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.
        Parameters:
        classPredicate - the class type predicate; never null
        Returns:
        an instance of ClassFilter; never null
      • 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.
        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​(java.lang.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​(java.lang.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