public final class TaskMapper extends Object
org.embulk.config.TaskSource into a task-defining interface that inherits Task.
It performs the same job with Embulk core's ConfigSource#loadTask on plugin's side.
public class ExampleInputPlugin implements InputPlugin {
public ExampleInputPlugin() {
this.configMapperFactory = org.embulk.util.config.ConfigMapperFactory.withDefault();
}
public interface PluginTask extends org.embulk.util.config.Task {
// ...
}
public ConfigDiff transaction(ConfigSource config, InputPlugin.Control control) {
// ...
}
public TaskReport run(TaskSource taskSource, Schema schema, int taskIndex, PageOutput output) {
final org.embulk.util.config.TaskMapper taskMapper = this.configMapperFactory.createTaskMapper();
final PluginTask task = taskMapper.map(taskSource, PluginTask.class);
// ...
}
// ...
private org.embulk.util.config.ConfigMapperFactory configMapperFactory;
}| Modifier and Type | Method and Description |
|---|---|
<T extends Task> |
map(TaskSource task,
Class<T> taskType)
Maps
org.embulk.config.TaskSource into a task-defining interface that inherits Task. |
public <T extends Task> T map(TaskSource task, Class<T> taskType)
org.embulk.config.TaskSource into a task-defining interface that inherits Task.T - the task-defining interfacetask - org.embulk.config.TaskSource to map fromtaskType - Class of the task-defining interface