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
Generic predicate that checks a candidate
Object
returned by a lookup function
against an injected predicate.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionStrategyIndirectedPredicate
(Function<T1, T2> objectStrategy, Collection<T2> collection) Constructor that simplifies constructing a test for containment in a collection, which is a common use case.Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic <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.boolean
-
Field Details
-
objectLookupStrategy
Lookup strategy for object. -
predicate
Predicate to apply to indirected object.
-
-
Constructor Details
-
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 Details
-
test
-
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
-