Class PredicateDrivenFunction<T,U>
java.lang.Object
net.shibboleth.utilities.java.support.logic.PredicateDrivenFunction<T,U>
- Type Parameters:
T
- type of input accepted by this functionU
- type of output produced by this function
- All Implemented Interfaces:
Function<T,U>
@ThreadSafe public class PredicateDrivenFunction<T,U> extends Object implements Function<T,U>
A
Function
that runs a Predicate
and then runs one of two other possible
functions based on the result.
If either function is null, the result will be null if that function were needed.
- Since:
- 8.2.0
-
Field Details
-
predicate
A predicate to apply. -
trueFunction
Function to apply if predicate is true. -
falseFunction
Function to apply if predicate is false.
-
-
Constructor Details
-
PredicateDrivenFunction
public PredicateDrivenFunction(@Nonnull @ParameterName(name="condition") Predicate<? super T> condition, @Nullable @ParameterName(name="whenTrue") Function<? super T,U> whenTrue, @Nullable @ParameterName(name="whenFalse") Function<? super T,U> whenFalse)Constructor.- Parameters:
condition
- predicate to applywhenTrue
- function to apply if predicate evaluates to truewhenFalse
- function to apply if predicate evaluates to false
-
-
Method Details