Class TransformerClosure<T>
- java.lang.Object
-
- org.apache.commons.collections4.functors.TransformerClosure<T>
-
- Type Parameters:
T- the type of the input to the operation.
- All Implemented Interfaces:
java.io.Serializable,java.util.function.Consumer<T>,Closure<T>
public class TransformerClosure<T> extends java.lang.Object implements Closure<T>, java.io.Serializable
Closure implementation that calls a Transformer using the input object and ignore the result.- Since:
- 3.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TransformerClosure(Transformer<? super T,?> transformer)Constructor that performs no validation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute(T input)Executes the closure by calling the decorated transformer.Transformer<? super T,?>getTransformer()Gets the transformer.static <E> Closure<E>transformerClosure(Transformer<? super E,?> transformer)Factory method that performs validation.
-
-
-
Constructor Detail
-
TransformerClosure
public TransformerClosure(Transformer<? super T,?> transformer)
Constructor that performs no validation. UsetransformerClosureif you want that.- Parameters:
transformer- the transformer to call, not null
-
-
Method Detail
-
transformerClosure
public static <E> Closure<E> transformerClosure(Transformer<? super E,?> transformer)
Factory method that performs validation.A null transformer will return the
NOPClosure.- Type Parameters:
E- the type that the closure acts on- Parameters:
transformer- the transformer to call, null means nop- Returns:
- the
transformerclosure
-
getTransformer
public Transformer<? super T,?> getTransformer()
Gets the transformer.- Returns:
- the transformer
- Since:
- 3.1
-
-