Package com.atlassian.jira.util
Class Predicates
java.lang.Object
com.atlassian.jira.util.Predicates
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic final classA predicate that always returns false.static classstatic final classA predicate that always returns true. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Predicate<T>Create a composite predicate that evaluates to true when both the passed predicates evaluate to true.static <T> Predicate<T>Create a composite predicate that evaluates to true when one the passed predicates evaluate to true.static <T> Predicate<T>equalTo(T check) A predicate that check that some input equals the passed argument.static <T> Predicate<T>Return a predicate that always returns false.static <T> Predicate<T>isInstanceOf(Class<? extends T> clazz) static <T> Predicate<T>isNull()A predicate that check that the input is null.static <T> Predicate<T>Create a predicate that inverts the behaviour of the passed predicate.static <T> Predicate<T>notNull()A predicate that check that the input is not null.static <T> Predicate<T>Return a predicate that always returns true.
-
Constructor Details
-
Predicates
public Predicates()
-
-
Method Details
-
truePredicate
Return a predicate that always returns true.- Type Parameters:
T- the type of input the predicate will work for.- Returns:
- a predicate that always returns true.
-
falsePredicate
Return a predicate that always returns false.- Type Parameters:
T- the type of input the predicate will work for.- Returns:
- a predicate that always returns false.
-
equalTo
A predicate that check that some input equals the passed argument.- Type Parameters:
T- the type- Parameters:
check- the element to check equality of, must not be null.- Returns:
- a Predicate that will return true if the input matches the argument.
-
notNull
A predicate that check that the input is not null.- Type Parameters:
T- the type- Returns:
- a Predicate that will return true if the input is not null.
-
isNull
A predicate that check that the input is null.- Type Parameters:
T- the type- Returns:
- a Predicate that will return true if the input is null.
-
isInstanceOf
-
allOf
Create a composite predicate that evaluates to true when both the passed predicates evaluate to true.- Parameters:
left- the first predicate.right- the second predicate.- Returns:
- a composite predicate that is only true when both the passed predicates evaluate to true.
-
anyOf
Create a composite predicate that evaluates to true when one the passed predicates evaluate to true.- Parameters:
left- the first predicate.right- the second predicate.- Returns:
- a composite predicate that is only true when both the passed predicates evaluate to true.
-
not
Create a predicate that inverts the behaviour of the passed predicate.- Type Parameters:
T- the type of the input for the predicate.- Parameters:
predicate- the predicate to negate. Cannot be null.- Returns:
- a predicate that inverts the behaviour of the passed predicate.
-