com.typesafe.config.Config.getMilliseconds()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(1.4k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中com.typesafe.config.Config.getMilliseconds()方法的一些代码示例,展示了Config.getMilliseconds()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.getMilliseconds()方法的具体详情如下:
包路径:com.typesafe.config.Config
类名称:Config
方法名:getMilliseconds

Config.getMilliseconds介绍

[英]Get value as a duration in milliseconds. If the value is already a number, then it's left alone; if it's a string, it's parsed understanding units suffixes like "10m" or "5ns" as documented in the the spec.
[中]获取以毫秒为单位的持续时间值。如果该值已经是一个数字,那么它将被忽略;如果它是一个字符串,则解析时需要理解the spec中记录的“10m”或“5ns”等单位后缀。

代码示例

代码示例来源:origin: apache/drill

@Override
public Long getMilliseconds(String path) {
 return c.getMilliseconds(path);
}

代码示例来源:origin: dremio/dremio-oss

@Override
public Long getMilliseconds(String path) {
 return config.getMilliseconds(path);
}

代码示例来源:origin: org.apache.drill/drill-common

@Override
public Long getMilliseconds(String path) {
 return c.getMilliseconds(path);
}

代码示例来源:origin: org.attribyte/acp

static final long getMilliseconds(final Config config, final String name) throws InitializationException {
 final long val;
 try {
   val = config.hasPath(name) ? config.getMilliseconds(name) : MISSING_LONG;
 } catch(ConfigException ce) {
   throw new InitializationException(ce.getMessage());
 }
 if(val == MISSING_LONG) {
   throw new InitializationException("The property, '" + name + "', must be supplied");
 } else if(val < 0) {
   throw new InitializationException("The property, '" + name + "', must not be negative");
 } else {
   return val;
 }
}

相关文章