Class StrategyIndirectedPredicate<T1,T2>
- java.lang.Object
-
- net.shibboleth.utilities.java.support.logic.StrategyIndirectedPredicate<T1,T2>
-
- Type Parameters:
T1- type of object used as the source of the data to compareT2- type of object being compared
public class StrategyIndirectedPredicate<T1,T2> extends Object implements Predicate<T1>
Generic predicate that checks a candidateObjectreturned by a lookup function against an injected predicate.
-
-
Constructor Summary
Constructors Constructor Description StrategyIndirectedPredicate(Function<T1,T2> objectStrategy, Collection<T2> collection)Constructor that simplifies constructing a test for containment in a collection, which is a common use case.StrategyIndirectedPredicate(Function<T1,T2> objectStrategy, Predicate<T2> pred)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T1,T2>
StrategyIndirectedPredicate<T1,T2>forCollection(Function<T1,T2> objectStrategy, Collection<T2> collection)Factory method for collection-based constructor.static <T1,T2>
StrategyIndirectedPredicate<T1,T2>forPredicate(Function<T1,T2> objectStrategy, Predicate<T2> pred)Factory method for predicate-based constructor.booleantest(T1 input)
-
-
-
Constructor Detail
-
StrategyIndirectedPredicate
public StrategyIndirectedPredicate(@ParameterName(name="objectStrategy") @Nonnull Function<T1,T2> objectStrategy, @ParameterName(name="pred") @Nonnull Predicate<T2> pred)
Constructor.- Parameters:
objectStrategy- lookup strategy for objectpred- the predicate to apply
-
StrategyIndirectedPredicate
public StrategyIndirectedPredicate(@ParameterName(name="objectStrategy") @Nonnull Function<T1,T2> objectStrategy, @ParameterName(name="collection") @Nonnull Collection<T2> collection)
Constructor that simplifies constructing a test for containment in a collection, which is a common use case.- Parameters:
objectStrategy- lookup strategy for objectcollection- a collection to test for containment
-
-
Method Detail
-
forPredicate
@Nonnull public static <T1,T2> StrategyIndirectedPredicate<T1,T2> forPredicate(@Nonnull Function<T1,T2> objectStrategy, @Nonnull Predicate<T2> pred)
Factory method for predicate-based constructor.- Type Parameters:
T1- type of object used as the source of the data to compareT2- type of object being compared- Parameters:
objectStrategy- the lookup strategy for objectpred- the predicate to apply- Returns:
- a suitably constructed predicate
- Since:
- 7.3.0
-
forCollection
@Nonnull public static <T1,T2> StrategyIndirectedPredicate<T1,T2> forCollection(@Nonnull Function<T1,T2> objectStrategy, @Nonnull Collection<T2> collection)
Factory method for collection-based constructor.- Type Parameters:
T1- type of object used as the source of the data to compareT2- type of object being compared- Parameters:
objectStrategy- the lookup strategy for objectcollection- a collection to test for containment- Returns:
- a suitably constructed predicate
- Since:
- 7.3.0
-
-