public class ClosureTransformer<T> extends Object implements Transformer<T,T>, Serializable
Constructor and Description |
---|
ClosureTransformer(Closure<? super T> closure)
Constructor that performs no validation.
|
Modifier and Type | Method and Description |
---|---|
static <T> Transformer<T,T> |
closureTransformer(Closure<? super T> closure)
Factory method that performs validation.
|
Closure<? super T> |
getClosure()
Gets the closure.
|
T |
transform(T input)
Transforms the input to result by executing a closure.
|
public ClosureTransformer(Closure<? super T> closure)
closureTransformer
if you want that.closure
- the closure to call, not nullpublic static <T> Transformer<T,T> closureTransformer(Closure<? super T> closure)
T
- the type of the object to transformclosure
- the closure to call, not nullclosure
transformerNullPointerException
- if the closure is nullpublic T transform(T input)
transform
in interface Transformer<T,T>
input
- the input object to transformpublic Closure<? super T> getClosure()
Copyright © 2001–2018 The Apache Software Foundation. All rights reserved.