allow generic steps to be used
* Adds a transformer to the chain.
*/
ChainBuilder map(Transformer<File> transformer);
+ /**
+ * Adds a generic step to the chain.
+ */
+ ChainBuilder withStep(ChainStep<File> step);
/**
* Actually consumes all the files supplied.
*/
@@ -81,13 +85,15 @@ public static ChainBuilder source(Source<File> source) {
this.source = source;
}
+ @Override
public ChainBuilder filter(Filter<File> filter) {
- chainDef.add(filter);
- return this;
+ return withStep(filter);
}
+ @Override
public ChainBuilder filter(FileFilter filter) {
return filter(new FileFilterAdapter(filter));
}
+ @Override
public ChainBuilder skipUnreadable() {
return filter(new FileFilter() {
@Override
@@ -96,6 +102,7 @@ public boolean accept(File f) {
}
});
}
+ @Override
public ChainBuilder skipNonFiles() {
return filter(new FileFilter() {
@Override
@@ -104,10 +111,16 @@ public boolean accept(File f) {
}
});
}
+ @Override
public ChainBuilder map(Transformer<File> transformer) {
- chainDef.add(transformer);
+ return withStep(transformer);
+ }
+ @Override
+ public ChainBuilder withStep(ChainStep<File> step) {
+ chainDef.add(step);
return this;
}
+ @Override
public void to(Sink<File> sink) throws IOException, ArchiveException {
chainDef.add(sink);
chainDef.freeze();
