Class Predicates

java.lang.Object
io.github.sugarcubes.cloner.Predicates

public class Predicates extends Object
  • Method Details

    • all

      public static <T> Predicate<T> all()
      Always true predicate.
      Type Parameters:
      T - object type
      Returns:
      always true predicate
    • not

      public static <T> Predicate<T> not(Predicate<T> predicate)
      Negates predicate.
      Type Parameters:
      T - object type
      Parameters:
      predicate - predicate
      Returns:
      negated predicate
    • equal

      public static <T> Predicate<T> equal(T referenceValue)
      Predicate which test an object is equal to reference value.
      Type Parameters:
      T - object type
      Parameters:
      referenceValue - reference value
      Returns:
      predicate
    • same

      public static <T> Predicate<T> same(T referenceValue)
      Predicate which test an object is same (==) as reference value.
      Type Parameters:
      T - object type
      Parameters:
      referenceValue - reference value
      Returns:
      predicate
    • annotatedWith

      public static <T extends AnnotatedElement, A extends Annotation> Predicate<T> annotatedWith(Class<A> annotation)
      Predicate which test an element is annotated with provided annotation.
      Type Parameters:
      T - element type
      A - annotation type
      Parameters:
      annotation - annotation type
      Returns:
      predicate
    • annotatedWithAny

      @SafeVarargs public static <T extends AnnotatedElement, A extends Annotation> Predicate<T> annotatedWithAny(Class<A> annotation, Class<A>... annotations)
      Predicate which test an element is annotated with any of provided annotations.
      Type Parameters:
      T - element type
      A - annotation type
      Parameters:
      annotation - annotation type
      annotations - annotation types
      Returns:
      predicate
    • subclass

      public static Predicate<Class<?>> subclass(Class<?> type)
      Predicate which test a class is subclass (including self) of the type.
      Parameters:
      type - type
      Returns:
      predicate