com.harrys.hyppo.source.api.model.TaskBuilder Maven / Gradle / Ivy
package com.harrys.hyppo.source.api.model;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigValueFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Created by jpetty on 8/27/15.
*/
public final class TaskBuilder {
private final List tasks;
public TaskBuilder() {
this.tasks = new ArrayList<>();
}
public final TaskBuilder addTask(Config taskArguments) {
this.tasks.add(new DataIngestionTask(null, this.tasks.size() + 1, taskArguments));
return this;
}
public final TaskBuilder addTask(final Map taskArguments) {
final Config args = ConfigValueFactory.fromMap(taskArguments).toConfig();
return this.addTask(args);
}
public final List build() {
final ArrayList output = new ArrayList(this.tasks);
return output;
}
}