org.fiolino.common.processing.sink.DecomposingSink Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons Show documentation
Show all versions of commons Show documentation
General structure to easily create dynamic logic via MethodHandles and others.
package org.fiolino.common.processing.sink;
import org.fiolino.common.container.Container;
/**
* Created by kuli on 31.03.16.
*/
public class DecomposingSink> extends ChainedSink
implements CloneableSink> {
public DecomposingSink(Sink super O> target) {
super(target);
}
@Override
public void accept(C values, Container metadata) throws Exception {
for (O each : values) {
getTarget().accept(each, metadata);
}
}
@Override
public DecomposingSink createClone() {
return new DecomposingSink<>(targetForCloning());
}
@Override
public void partialCommit(Container metadata) throws Exception {
if (getTarget() instanceof CloneableSink) {
((CloneableSink, ?>) getTarget()).partialCommit(metadata);
}
}
}