mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
allow conversion of missing config types
This commit is contained in:
@@ -131,10 +131,20 @@ public class ConfigModel implements NBConfigModel {
|
||||
return (T) Double.valueOf(string);
|
||||
} else if (type == BigDecimal.class) {
|
||||
return (T) BigDecimal.valueOf(Double.parseDouble(string));
|
||||
} else if (type == boolean.class || type == Boolean.class) {
|
||||
return (T) Boolean.valueOf(Boolean.parseBoolean(string));
|
||||
} else {
|
||||
throw new RuntimeException("CharSequence type " + type.getSimpleName() + " could " +
|
||||
" not be converted from " + value.getClass().getSimpleName());
|
||||
}
|
||||
} else if (value instanceof Boolean bool) {
|
||||
if (type == boolean.class) {
|
||||
return (T) bool;
|
||||
} else {
|
||||
throw new RuntimeException("Boolean type " + type.getSimpleName() + " could " +
|
||||
" not be converted from " + value.getClass().getSimpleName());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -318,11 +328,10 @@ public class ConfigModel implements NBConfigModel {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("[").append(
|
||||
params.stream().map(p -> p.getNames().get(0)).collect(Collectors.joining(",")))
|
||||
.append("]");
|
||||
String sb = "[" +
|
||||
params.stream().map(p -> p.getNames().get(0)).collect(Collectors.joining(",")) +
|
||||
"]";
|
||||
|
||||
return sb.toString();
|
||||
return sb;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user