Class ClosureTransformer<T>
java.lang.Object
org.apache.commons.collections4.functors.ClosureTransformer<T>
- Type Parameters:
T- the type of the input and result to the function.
- All Implemented Interfaces:
Serializable,Function<T,,T> Transformer<T,T>
Transformer implementation that calls a Closure using the input object
and then returns the input.
- Since:
- 3.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionClosureTransformer(Closure<? super T> closure) Constructor that performs no validation. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Transformer<T, T> closureTransformer(Closure<? super T> closure) Factory method that performs validation.Gets the closure.Transforms the input to result by executing a closure.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.collections4.Transformer
apply
-
Constructor Details
-
ClosureTransformer
Constructor that performs no validation. UseclosureTransformerif you want that.- Parameters:
closure- the closure to call, not null
-
-
Method Details
-
closureTransformer
Factory method that performs validation.- Type Parameters:
T- the type of the object to transform- Parameters:
closure- the closure to call, not null- Returns:
- the
closuretransformer - Throws:
NullPointerException- if the closure is null
-
getClosure
-
transform
-