mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-12-24 16:00:09 -06:00
provide a default empty configuration
This commit is contained in:
parent
b1e915a4b8
commit
3a0186fef4
@ -1,5 +1,6 @@
|
||||
package io.nosqlbench.nb.api.config.standard;
|
||||
|
||||
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
|
||||
import io.nosqlbench.nb.api.errors.BasicError;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -27,6 +28,14 @@ public class ConfigModel implements NBConfigModel {
|
||||
return new ConfigModel(ofType);
|
||||
}
|
||||
|
||||
public static NBConfiguration defacto(ActivityDef def) {
|
||||
ConfigModel configModel = new ConfigModel(Object.class);
|
||||
for (Map.Entry<String, Object> entry : def.getParams().entrySet()) {
|
||||
configModel.add(Param.defaultTo(entry.getKey(),entry.getValue().toString()));
|
||||
}
|
||||
return configModel.apply(def.getParams());
|
||||
}
|
||||
|
||||
public <T> ConfigModel add(Param<T> param) {
|
||||
this.params.add(param);
|
||||
for (String name : param.getNames()) {
|
||||
|
@ -25,6 +25,10 @@ public class NBConfiguration {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
public static NBConfiguration empty() {
|
||||
return new NBConfiguration(ConfigModel.of(Object.class).asReadOnly(),new LinkedHashMap<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of the named parameter as {@link #getOptional(String)}, so long
|
||||
* as no env vars were reference OR all env var references were found.
|
||||
|
Loading…
Reference in New Issue
Block a user