net.shibboleth.utilities.java.support.logic
Class PredicateSupport

java.lang.Object
  extended by net.shibboleth.utilities.java.support.logic.PredicateSupport

public final class PredicateSupport
extends Object

Helper class for constructing predicates. Especially useful for creating internal DSLs via Java's static method import mechanism.


Constructor Summary
private PredicateSupport()
          Constructor.
 
Method Summary
static
<T> com.google.common.base.Predicate<Iterable<T>>
allMatch(com.google.common.base.Predicate<T> target)
          Creates a predicate that checks that all elements of an Iterable matches a given target predicate.
static
<T> com.google.common.base.Predicate<Iterable<T>>
anyMatch(com.google.common.base.Predicate<T> target)
          Creates a predicate that checks that any element in an Iterable matches a given target predicate.
static com.google.common.base.Predicate<CharSequence> caseInsensitiveMatch(String target)
          Creates a predicate that checks if a given CharSequence matches a target string while ignoring case.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PredicateSupport

private PredicateSupport()
Constructor.

Method Detail

allMatch

@Nonnull
public static <T> com.google.common.base.Predicate<Iterable<T>> allMatch(@Nonnull
                                                                                 com.google.common.base.Predicate<T> target)
Creates a predicate that checks that all elements of an Iterable matches a given target predicate.

Type Parameters:
T - type of objects in the iterable and that the target operates upon
Parameters:
target - predicate used to check each element in the iterable
Returns:
the constructed predicate

anyMatch

@Nonnull
public static <T> com.google.common.base.Predicate<Iterable<T>> anyMatch(@Nonnull
                                                                                 com.google.common.base.Predicate<T> target)
Creates a predicate that checks that any element in an Iterable matches a given target predicate.

Type Parameters:
T - type of objects in the iterable and that the target operates upon
Parameters:
target - predicate used to check each element in the iterable
Returns:
the constructed predicate

caseInsensitiveMatch

@Nonnull
public static com.google.common.base.Predicate<CharSequence> caseInsensitiveMatch(@Nonnull
                                                                                          String target)
Creates a predicate that checks if a given CharSequence matches a target string while ignoring case.

Parameters:
target - the target string to match against
Returns:
the constructed predicate


Copyright © 1999-2012. All Rights Reserved.