|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.shibboleth.utilities.java.support.logic.TransformAndCheckFunction<T>
T - type of input accepted by this function@ThreadSafe public class TransformAndCheckFunction<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.absent() is returned. If the constraint
is not met and failOnConstraintViolation is true then an IllegalArgumentException is thrown.
| Field Summary | |
|---|---|
private com.google.common.base.Predicate<T> |
constraint
A constraint which must be met in order for an input to be valid. |
private boolean |
failOnConstraintViolation
Whether input that does not meet the constraint should cause an error or just be silently dropped. |
private com.google.common.base.Function<T,? extends T> |
preprocessor
A function applied to input prior to being constraint checked and accepted. |
| Constructor Summary | |
|---|---|
TransformAndCheckFunction(com.google.common.base.Function<T,? extends T> inputPreprocessor,
com.google.common.base.Predicate<T> inputConstraint,
boolean failOnInputConstraintViolation)
Constructor. |
|
| Method Summary | |
|---|---|
com.google.common.base.Optional<? extends T> |
apply(T input)
|
boolean |
equals(Object obj)
|
int |
hashCode()
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private final com.google.common.base.Function<T,? extends T> preprocessor
private final com.google.common.base.Predicate<T> constraint
private final boolean failOnConstraintViolation
| Constructor Detail |
|---|
public TransformAndCheckFunction(@Nonnull
com.google.common.base.Function<T,? extends T> inputPreprocessor,
@Nonnull
com.google.common.base.Predicate<T> inputConstraint,
boolean failOnInputConstraintViolation)
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 Detail |
|---|
public com.google.common.base.Optional<? extends T> apply(T input)
apply in interface com.google.common.base.Function<T,com.google.common.base.Optional<? extends T>>public boolean equals(Object obj)
equals in interface com.google.common.base.Function<T,com.google.common.base.Optional<? extends T>>equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||