Package net.shibboleth.shared.logic
Class TransformAndCheckFunction<T>
java.lang.Object
net.shibboleth.shared.logic.TransformAndCheckFunction<T>
- Type Parameters:
T- type of input accepted by this function
@ThreadSafe
public class TransformAndCheckFunction<T>
extends Object
implements Function<T,Optional<? extends T>>
A
Function that receives an input, runs it through a pre-processor and checks the result against a
constraint. If the constraint matches that value is returned, wrapped in an Optional. If the constraint is
not met and failOnConstraintViolation is false then Optional.empty() is returned. If the constraint
is not met and failOnConstraintViolation is true then an IllegalArgumentException is thrown.-
Field Summary
FieldsModifier and TypeFieldDescriptionA constraint which must be met in order for an input to be valid.private final booleanWhether input that does not meet the constraint should cause an error or just be silently dropped.A function applied to input prior to being constraint checked and accepted. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
preprocessor
A function applied to input prior to being constraint checked and accepted. -
constraint
A constraint which must be met in order for an input to be valid. -
failOnConstraintViolation
private final boolean failOnConstraintViolationWhether input that does not meet the constraint should cause an error or just be silently dropped.
-
-
Constructor Details
-
TransformAndCheckFunction
public TransformAndCheckFunction(@Nonnull Function<T, ? extends T> inputPreprocessor, @Nonnull Predicate<T> inputConstraint, boolean failOnInputConstraintViolation) Constructor.- Parameters:
inputPreprocessor- function applied to input prior to being constraint checked and acceptedinputConstraint- constraint which must be met in order for an input to be validfailOnInputConstraintViolation- whether input that does not meet the constraint should cause an error or just be ignored
-
-
Method Details