com.atlassian.jira.util
Class Predicates

java.lang.Object
  extended by com.atlassian.jira.util.Predicates

public class Predicates
extends Object


Nested Class Summary
static class Predicates.And<T>
           
static class Predicates.Composite<T>
           
static class Predicates.FalsePredicate<T>
          A predicate that always returns false.
static class Predicates.Or<T>
           
static class Predicates.TruePredicate<T>
          A predicate that always returns true.
 
Constructor Summary
Predicates()
           
 
Method Summary
static
<T> Predicate<T>
allOf(Predicate<? super T> left, Predicate<? super T> right)
          Create a composite predicate that evaluates to true when both the passed predicates evaluate to true.
static
<T> Predicate<T>
anyOf(Predicate<? super T> left, Predicate<? super T> right)
          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>
falsePredicate()
          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>
not(Predicate<? super T> predicate)
          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>
truePredicate()
          Return a predicate that always returns true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Predicates

public Predicates()
Method Detail

truePredicate

public static <T> Predicate<T> 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

public static <T> Predicate<T> 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

public static <T> Predicate<T> equalTo(@NotNull
                                       T check)
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

public static <T> Predicate<T> 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

public static <T> Predicate<T> 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

public static <T> Predicate<T> isInstanceOf(Class<? extends T> clazz)

allOf

public static <T> Predicate<T> allOf(Predicate<? super T> left,
                                     Predicate<? super T> right)
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

public static <T> Predicate<T> anyOf(Predicate<? super T> left,
                                     Predicate<? super T> right)
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

public static <T> Predicate<T> not(Predicate<? super T> predicate)
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.


Copyright © 2002-2013 Atlassian. All Rights Reserved.