Hi all,
I am evaluating configuration frameworks and have a need that I'm not sure Owner can support. I'd just like to confirm my understanding and possibly suggest a solution before ruling out Owner as an option.
I see the
variable expansion in keys, which is great. However, it's based on the value of another key rather than a runtime parameter. In my case I'd like to define keys such as this:
Country.Preference.1=UNITED STATES
Country.Preference.2=GERMANY
Country.Preference=CANADA # Default - this does need to be in config so can't be in a defaultvalue annotation.
And I'd like to pass the value for "1" or "2" as a parameter at runtime when I request the property value. I cannot define these values as an array because the keys will not always be sequential.
Would it be possible to have the values returned as a Map? I see in the documentation that the Map interface and sub-interfaces are not supported. But suppose I defined a getter like so:
ConfigMap<String, String> countryPreference();
Then usage like this:
cfg.countryPreference().get("1") => Result in "UNITED STATES"
cfg.countryPreference().get("2") => Results in "GERMANY"
cfg.countryPreference().get("ANYTHING ELSE") => Results in "CANADA"
The ConfigMap class would just subclass HashMap and override get() to handle the default case.
Thanks,
Justin