Package software.amazon.awssdk.utils
Interface ConditionalDecorator<T>
-
- Type Parameters:
T
- A type that can be decorated, or transformed, through applying a function.
- All Known Implementing Classes:
DefaultConditionalDecorator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ConditionalDecorator<T>
An interface that defines a class that contains a transform for another type as well as a condition for whether that transform should be applied.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static <T> ConditionalDecorator<T>
create(Predicate<T> predicate, UnaryOperator<T> transform)
static <T> T
decorate(T initialValue, List<ConditionalDecorator<T>> decorators)
This function will transform an initially supplied value with provided transforming, or decorating, functions that are conditionally and sequentially applied.default Predicate<T>
predicate()
UnaryOperator<T>
transform()
-
-
-
Method Detail
-
transform
UnaryOperator<T> transform()
-
create
static <T> ConditionalDecorator<T> create(Predicate<T> predicate, UnaryOperator<T> transform)
-
decorate
static <T> T decorate(T initialValue, List<ConditionalDecorator<T>> decorators)
This function will transform an initially supplied value with provided transforming, or decorating, functions that are conditionally and sequentially applied. For each pair of condition and transform: if the condition evaluates to true, the transform will be applied to the incoming value and the output from the transform is the input to the next transform.If the supplied collection is ordered, the function is guaranteed to apply the transforms in the order in which they appear in the collection.
- Type Parameters:
T
- The type of the value- Parameters:
initialValue
- The untransformed start valuedecorators
- A list of condition to transform- Returns:
- A single transformed value that is the result of applying all transforms evaluated to true
-
-