本文整理了Java中com.typesafe.config.Config.getNumber()
方法的一些代码示例,展示了Config.getNumber()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.getNumber()
方法的具体详情如下:
包路径:com.typesafe.config.Config
类名称:Config
方法名:getNumber
暂无
代码示例来源:origin: apache/drill
@Override
public Number getNumber(String path) {
return c.getNumber(path);
}
代码示例来源:origin: org.apache.drill/drill-common
@Override
public Number getNumber(String path) {
return c.getNumber(path);
}
代码示例来源:origin: dremio/dremio-oss
@Override
public Number getNumber(String path) {
return config.getNumber(path);
}
代码示例来源:origin: graylog-labs/collector
public InputConfiguration(String id, Config config) {
this.id = id;
if (config.hasPath("outputs")) {
this.outputs = Sets.newHashSet(Splitter.on(",").omitEmptyStrings().trimResults().split(config.getString("outputs")));
}
if (config.hasPath("message-fields")) {
final Config messageFieldsConfig = config.getConfig("message-fields");
for (Map.Entry<String, ConfigValue> entry : messageFieldsConfig.entrySet()) {
final String key = entry.getKey();
final ConfigValue value = entry.getValue();
switch (value.valueType()) {
case NUMBER:
this.messageFields.put(key, messageFieldsConfig.getNumber(key));
break;
case BOOLEAN:
this.messageFields.put(key, messageFieldsConfig.getBoolean(key));
break;
case STRING:
this.messageFields.put(key, messageFieldsConfig.getString(key));
break;
default:
log.warn("{}[{}] Message field value of type \"{}\" is not supported for key \"{}\" (value: {})",
getClass().getSimpleName(), getId(), value.valueType(), key, value.toString());
break;
}
}
}
}
代码示例来源:origin: com.scireum/sirius-kernel
field.set(target, new HashSet<>(config.getStringList(key)));
} else if (float.class.equals(field.getType()) || Float.class.equals(field.getType())) {
field.set(target, config.getNumber(key).floatValue());
} else if (double.class.equals(field.getType()) || Double.class.equals(field.getType())) {
field.set(target, config.getNumber(key).doubleValue());
} else {
throw new IllegalArgumentException(Strings.apply("Cannot fill field '%s.%s' of type %s with a config value!",
代码示例来源:origin: apache/eagle
for (Map.Entry<String, ConfigValue> entry: appStormConf.entrySet()) {
if (NumberUtils.isNumber(entry.getValue().unwrapped().toString())) {
conf.put(entry.getKey(), appStormConf.getNumber(entry.getKey()));
} else {
conf.put(entry.getKey(), entry.getValue().unwrapped());
内容来源于网络,如有侵权,请联系作者删除!