eclipse / ConfigJSR

JSR382
Apache License 2.0
30 stars 22 forks source link

ConfigAccessor methods revisit #94

Closed Emily-Jiang closed 5 years ago

Emily-Jiang commented 6 years ago

On ConfigAccessor, there are three methods:

ConfigAccessor<T> withDefault(T value);
ConfigAccessor<T> withStringDefault(String value);
T getDefaultValue();

The above methods are not needed as:

  1. for mandatory properties, you will use getValue to get the value of the prop
  2. for optional properties, you will use getOptionalValue to get the value of the optional prop In this way, it syncs well with Config.
struberg commented 5 years ago

No they might be nice to have nevertheless. You might have multiple locations where you access this config. And you would need to put a .orElse to every of these locations.

Emily-Jiang commented 5 years ago

Let's close this one as some changes have gone in to address some of the concern.