|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.unkrig.commons.lang.protocol.PredicateUtil
public final class PredicateUtil
Various Predicate-related utility methods.
| Method Summary | ||
|---|---|---|
static Predicate<java.lang.Object> |
after(long expirationTime)
Returns a Predicate<Object> that evaluates to true iff the current time is after the given
expiration time. |
|
static
|
always()
|
|
static
|
and(Predicate<? super T> p1,
Predicate<? super T> p2)
Returns a Predicate which returns true iff both p1 and p2 return true
for any given subject. |
|
static
|
asPredicate(PredicateWhichThrows<T,EX> source)
Converts a PredicateWhichThrows into a Predicate, which is possible iff the source's exception
is a subclass of RuntimeException and the source's element type is a subclass of the target's element
type. |
|
static
|
asPredicateWhichThrows(Predicate<? super T> source)
Converts a Predicate into a PredicateWhichThrows, which is possible iff the source's element
type is a subclass of the target's element type. |
|
static
|
between(C min,
C max)
|
|
static
|
contains(java.util.Collection<? extends T> collection)
|
|
static
|
containsKey(java.util.Map<K,?> map)
|
|
static
|
containsKey(Mapping<K,?> mapping)
|
|
static
|
equal(C other)
|
|
static
|
equals(T other)
Value equality |
|
static
|
forString(java.lang.String format,
T delegate)
Returns a predicate that evaluates the format against the delegate after each "*" in the format has been replaced with the subject. |
|
static
|
greater(C other)
|
|
static
|
greaterEqual(C other)
|
|
static
|
less(C other)
|
|
static
|
lessEqual(C other)
|
|
static
|
never()
|
|
static
|
not(Predicate<T> delegate)
|
|
static
|
notEqual(C other)
|
|
static
|
notEquals(T other)
Value equality |
|
static
|
or(Predicate<? super T> p1,
Predicate<? super T> p2)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <T> Predicate<T> always()
Predicate who's Predicate.evaluate(Object) method always returns true.public static <T> Predicate<T> never()
Predicate who's Predicate.evaluate(Object) method always returns false.
public static <T> Predicate<T> and(Predicate<? super T> p1,
Predicate<? super T> p2)
Predicate which returns true iff both p1 and p2 return true
for any given subject.
Notice: A new predicate object needs to be allocated only if neither of the arguments is never() or always().
public static <T> Predicate<T> or(Predicate<? super T> p1,
Predicate<? super T> p2)
Predicate which returns true if p1 or p2 returns true
for a given subject.public static <T> Predicate<T> not(Predicate<T> delegate)
Predicate which returns true iff the delegate returns false for any
given subject.public static <C extends java.lang.Comparable<C>> Predicate<C> less(C other)
Predicate which returns true iff a given subject is less than the
other.public static <C extends java.lang.Comparable<C>> Predicate<C> lessEqual(C other)
Predicate which returns true iff a given subject is less than or equal to the
other.public static <C extends java.lang.Comparable<C>> Predicate<C> greater(C other)
Predicate which returns true iff a given subject is greater than the
other.public static <C extends java.lang.Comparable<C>> Predicate<C> greaterEqual(C other)
Predicate which returns true iff a given subject is greater than or equal to
the other.public static <C extends java.lang.Comparable<C>> Predicate<C> equal(C other)
Predicate which returns true iff a given subject is (arithmetically) equal
to the other.public static <C extends java.lang.Comparable<C>> Predicate<C> notEqual(C other)
Predicate which returns true iff a given subject is (arithmetically) not equal
to the other.
public static <C extends java.lang.Comparable<C>> Predicate<C> between(C min,
C max)
min <= subject <= max, or, if min > max: subject >= min || subject <= maxpublic static <T> Predicate<T> equals(T other)
public static <T> Predicate<T> notEquals(T other)
public static Predicate<java.lang.Object> after(long expirationTime)
Predicate<Object> that evaluates to true iff the current time is after the given
expiration time.
(The returned predicate ignores its subject argument.)
public static <T extends Predicate<java.lang.String>> T forString(java.lang.String format,
T delegate)
format against the delegate after each "*" in the format has been replaced with the subject.
with
public static <T,EX extends java.lang.Throwable> PredicateWhichThrows<T,EX> asPredicateWhichThrows(Predicate<? super T> source)
Predicate into a PredicateWhichThrows, which is possible iff the source's element
type is a subclass of the target's element type.
T - The subject typeEX - The target predicate's exceptionpublic static <T,EX extends java.lang.RuntimeException> Predicate<T> asPredicate(PredicateWhichThrows<T,EX> source)
PredicateWhichThrows into a Predicate, which is possible iff the source's exception
is a subclass of RuntimeException and the source's element type is a subclass of the target's element
type.
T - The predicate subject typeEX - The source predicate's exceptionpublic static <T> Predicate<T> contains(java.util.Collection<? extends T> collection)
collection contains the subjectpublic static <K> Predicate<K> containsKey(java.util.Map<K,?> map)
Predicate that evaluates to true iff the map contains a key equal to the
predicate subjectpublic static <K> Predicate<K> containsKey(Mapping<K,?> mapping)
Predicate that evaluates to true iff the mapping contains a key equal to the
predicate subject
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||