public final class ConfigMapper extends Object
org.embulk.config.ConfigSource
into a task-defining interface that inherits Task
.
It performs the same job with Embulk core's ConfigSource#loadConfig
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(final ConfigSource config, final InputPlugin.Control control) {
final org.embulk.util.config.ConfigMapper configMapper = this.configMapperFactory.createConfigMapper();
final PluginTask task = configMapper.map(config, PluginTask.class);
// ...
}
// ...
private org.embulk.util.config.ConfigMapperFactory configMapperFactory;
}
Modifier and Type | Method and Description |
---|---|
<T extends Task> |
map(ConfigSource config,
Class<T> taskType)
Maps
org.embulk.config.ConfigSource into a task-defining interface that inherits Task . |
public <T extends Task> T map(ConfigSource config, Class<T> taskType)
org.embulk.config.ConfigSource
into a task-defining interface that inherits Task
.T
- the task-defining interfaceconfig
- org.embulk.config.ConfigSource
to map fromtaskType
- Class
of the task-defining interface