net.intelie.pipes.ModuleBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pipes-api Show documentation
Show all versions of pipes-api Show documentation
Intelie Pipes' API classes and interfaces
package net.intelie.pipes;
import net.intelie.pipes.types.Type;
import net.intelie.pipes.util.Iterables;
import java.util.ArrayList;
import java.util.List;
public class ModuleBuilder {
private final List functions = new ArrayList<>();
public ModuleBuilder add(Function function) {
this.functions.add(function);
return this;
}
public ModuleBuilder addModule(Module module) {
Iterables.addAll(functions, module.functions());
return this;
}
public ModuleBuilder addRaw(String name, Object value) {
return add(new RawFunction(name, value));
}
public ModuleBuilder addValue(String name, Object value) {
return add(new ValueFunction(name, value));
}
public ModuleBuilder addValue(String name, Type type, Object value) {
return add(new ValueFunction(name, type, value));
}
public List raw() {
return functions;
}
public Module build() {
return new ListModule(raw());
}
}