java.lang.Object
io.github.sugarcubes.cloner.Predicates
Predicates factory, for the predicate variants of
ReflectionClonerBuilder.typeAction(Predicate, CopyAction)
and ReflectionClonerBuilder.fieldAction(Predicate, CopyAction).-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Predicate<T>all()Always true predicate.static <T extends AnnotatedElement,A extends Annotation>
Predicate<T>annotatedWith(Class<A> annotation) Predicate which test an element is annotated with provided annotation.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.static <T> Predicate<T>equal(T referenceValue) Predicate which test an object is equal to reference value.static <T> Predicate<T>Negates predicate.static <T> Predicate<T>same(T referenceValue) Predicate which test an object is same (==) as reference value.Predicate which test a class is subclass (including self) of the type.
-
Method Details
-
all
Always true predicate.- Type Parameters:
T- object type- Returns:
- always true predicate
-
not
Negates predicate.- Type Parameters:
T- object type- Parameters:
predicate- predicate- Returns:
- negated predicate
-
equal
Predicate which test an object is equal to reference value.- Type Parameters:
T- object type- Parameters:
referenceValue- reference value- Returns:
- predicate
-
same
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 typeA- 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 typeA- annotation type- Parameters:
annotation- annotation typeannotations- annotation types- Returns:
- predicate
-
subclass
Predicate which test a class is subclass (including self) of the type.- Parameters:
type- type- Returns:
- predicate
-