mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
allow easy include/exclude of cql driver versions
This commit is contained in:
@@ -74,8 +74,9 @@ public class NBConfiguration {
|
||||
if (param==null) {
|
||||
throw new NBConfigError("Parameter named '" + name + "' is not valid for " + model.getOf().getSimpleName() + ".");
|
||||
}
|
||||
if (!param.isRequired()) {
|
||||
throw new NBConfigError("Non-optional get on parameter declared optional '" + name + "'");
|
||||
if ((!param.isRequired())&¶m.getDefaultValue()==null) {
|
||||
throw new RuntimeException("Non-optional get on optional parameter " + name + "' which has no default value while configuring " + model.getOf() + "." +
|
||||
"\nTo avoid user impact, ensure that ConfigModel and NBConfigurable usage are aligned.");
|
||||
}
|
||||
|
||||
Object o = data.get(name);
|
||||
|
||||
@@ -77,12 +77,28 @@ public class Param<T> {
|
||||
return new Param<V>(List.of(name), type, null, false, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameters which are given a default value are automatically marked as required, as the default
|
||||
* value allows them to be accessed as such.
|
||||
* @param name
|
||||
* @param defaultValue
|
||||
* @param <V>
|
||||
* @return
|
||||
*/
|
||||
public static <V> Param<V> defaultTo(String name, V defaultValue) {
|
||||
return new Param<V>(List.of(name), (Class<V>) defaultValue.getClass(), null, false, null);
|
||||
return new Param<V>(List.of(name), (Class<V>) defaultValue.getClass(), null, true, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameters which are given a default value are automatically marked as required, as the default
|
||||
* value allows them to be accessed as such.
|
||||
* @param names
|
||||
* @param defaultValue
|
||||
* @param <V>
|
||||
* @return
|
||||
*/
|
||||
public static <V> Param<V> defaultTo(List<String> names, V defaultValue) {
|
||||
return new Param<V>(names, (Class<V>) defaultValue.getClass(), null, false, null);
|
||||
return new Param<V>(names, (Class<V>) defaultValue.getClass(), null, true, defaultValue);
|
||||
}
|
||||
|
||||
public static <V> Param<V> required(String name, Class<V> type) {
|
||||
|
||||
Reference in New Issue
Block a user