reactor.groovy.support.ClosureTupleConsumer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of reactor-groovy-extensions Show documentation
Show all versions of reactor-groovy-extensions Show documentation
Reactor Groovy Ext components
The newest version!
package reactor.groovy.support;
import groovy.lang.Closure;
import reactor.function.Consumer;
import reactor.tuple.Tuple;
/**
* Invokes a {@link groovy.lang.Closure} using the contents of the incoming {@link reactor.tuple.Tuple} as the
* arguments.
*
* @author Jon Brisbin
*/
public class ClosureTupleConsumer implements Consumer {
private final Closure cl;
public ClosureTupleConsumer(Closure cl) {
this.cl = cl;
}
@Override
public void accept(Tuple tup) {
cl.call(tup.toArray());
}
}