mirror of
https://github.com/lightbend/config.git
synced 2025-01-28 21:20:07 +08:00
make getDuration return unboxed long
This way it's clear it can't be null
This commit is contained in:
parent
42933ebc99
commit
4dd6c85cab
@ -610,7 +610,7 @@ public interface Config extends ConfigMergeable {
|
||||
* @throws ConfigException.BadValue
|
||||
* if value cannot be parsed as a number of the given TimeUnit
|
||||
*/
|
||||
Long getDuration(String path, TimeUnit unit);
|
||||
long getDuration(String path, TimeUnit unit);
|
||||
|
||||
/**
|
||||
* Gets a list value (with any element type) as a {@link ConfigList}, which
|
||||
|
@ -256,9 +256,9 @@ final class SimpleConfig implements Config, MergeableValue, Serializable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getDuration(String path, TimeUnit unit) {
|
||||
public long getDuration(String path, TimeUnit unit) {
|
||||
ConfigValue v = find(path, ConfigValueType.STRING);
|
||||
Long result = unit.convert(
|
||||
long result = unit.convert(
|
||||
parseDuration((String) v.unwrapped(), v.origin(), path),
|
||||
TimeUnit.NANOSECONDS);
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user