Package net.shibboleth.shared.logic

# Class StrategyIndirectedPredicate<T1,T2>

java.lang.Object
net.shibboleth.shared.logic.StrategyIndirectedPredicate<T1,T2>

Type Parameters:
  `T1` - type of object used as the source of the data to compare
  `T2` - type of object being compared

All Implemented Interfaces:
  `Predicate<T1>`

public class StrategyIndirectedPredicate<T1,T2> extends Object implements Predicate<T1>
Generic predicate that checks a candidate `Object` returned by a lookup function against an injected predicate.

## Field Summary

Fields
Modifier and Type
Field
Description
`private final Function<T1,T2>`
`objectLookupStrategy`
Lookup strategy for object.
`private final Predicate<T2>`
`predicate`
Predicate to apply to indirected object.

## 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

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.
`boolean`
`test(T1 input)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.util.function.Predicate

`and, negate, or`

## Field Details

### objectLookupStrategy

@Nonnull private final Function<T1,T2> objectLookupStrategy
Lookup strategy for object.

### predicate

@Nonnull private final Predicate<T2> 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 object
  `pred` - the predicate to apply

### StrategyIndirectedPredicate

public StrategyIndirectedPredicate(@ParameterName(name="objectStrategy") @Nonnull Function<T1,T2> objectStrategy, @ParameterName(name="collection") @Nonnull @NullableElements 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 object
  `collection` - a collection to test for containment

## Method Details

### test

public boolean test(@Nullable T1 input)

Specified by:
  `test` in interface `Predicate<T1>`

### 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 compare
  `T2` - type of object being compared
Parameters:
  `objectStrategy` - the lookup strategy for object
  `pred` - 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 compare
  `T2` - type of object being compared
Parameters:
  `objectStrategy` - the lookup strategy for object
  `collection` - a collection to test for containment
Returns:
  a suitably constructed predicate
Since:
  7.3.0