Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property keys defined at methods overridden by sub-interface not mapped by PropertiesManager #421

Open
h-arlt opened this issue May 8, 2024 · 0 comments

Comments

@h-arlt
Copy link

h-arlt commented May 8, 2024

We make excessive usage of Owner configuration interfaces (would not do if it wouldn't be such a great library 🙌 ) that all share the same design pattern.

Configuration that is common for a certain functionality is defined in a configuration interface BaseConfig whereas concrete implementations of this functionality use their own configuration interfaces that extend BaseConfig and override methods as necessary such that BaseConfig represents the application default settings that may be overwritten by concrete settings, all using their own property keys and default values.

For example, consider the following configuration interfaces:

interface BaseConfig extends Accessible {
  /// ...
  @Key("feature.default.setting")
  @DefaultValue("-1")
  public long getSetting();

  // ...
}

interface ConcreteFeatureConfig extends BaseConfig {
  // ...
  @Key("feature.concreate.setting")
  @DefaultValue("42")
  @Override
  public long getSetting();

  // ...
}

When we now invoke Accessible#getProperty on an instane of such a concrete configuration interface, we'll get null for all property keys defined at methods overriden by the sub-interface although the overall set of property keys do not overlap and all having their own default value.
This is somewhat unexpected and may become an issue for other users too. I'd rather expect that PropertiesManager keeps track of all properties mapped by a configuration interface, including those that are defined at overriden methods in some super interface, since an override is not a replacement but an overlay.

Could you pleaes clarify whether the observed behavior is per intention and/or our design pattern fits into Owner's concepts .

Thanks in advance and for your efforts 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant