Skip to content

Commit

Permalink
Fix Number type for getters in config
Browse files Browse the repository at this point in the history
  • Loading branch information
minborg committed Jan 13, 2016
1 parent 8d9bb23 commit c8b3f0d
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -71,19 +71,19 @@ public OptionalBoolean getAsBoolean(String key) {

@Override
public OptionalLong getAsLong(String key) {
final Double value = (Double) config.get(key);
final Number value = (Number) config.get(key);
return value == null ? OptionalLong.empty() : OptionalLong.of(value.longValue());
}

@Override
public OptionalDouble getAsDouble(String key) {
final Double value = (Double) config.get(key);
return value == null ? OptionalDouble.empty() : OptionalDouble.of(value);
final Number value = (Number) config.get(key);
return value == null ? OptionalDouble.empty() : OptionalDouble.of(value.doubleValue());
}

@Override
public OptionalInt getAsInt(String key) {
final Double value = (Double) config.get(key);
final Number value = (Number) config.get(key);
return value == null ? OptionalInt.empty() : OptionalInt.of(value.intValue());
}

Expand Down

0 comments on commit c8b3f0d

Please sign in to comment.