I was wondering how the current method of configuration came into existence. I googled
against the
lists and didn't see anything particularly enlightening.
IMO the promise of component management is "you ask for it and it's there".
The best way I can imagine to ask for a configuration parameter would be:
@Requirement("my-module.param")
private String configParam = "default value";
If no parameter was defined then "default value" would be the value.
Since I imagine making the component manager inject a String and know that it's a
configuration
parameter would be horrible, I would have chosen a workaround by creating an interface and
class
which is shared among all consumers of configuration. Something like:
public interface ConfigurationString
{
java.lang.String get();
ConfigurationString default(java.lang.String);
}
Then to get the configuration parameter you need:
@Requirement("my-module.param")
private ConfigurationString myParam = ConfigurationString.default("default
value");
Since the benefits of writing 2 lines to get a configuration parameter vs. writing 2
classes seem
obvious, I assume that this idea was reviewed and cast aside and I was wondering why it
was decided
that something like this was the wrong approach.
If anyone could shed some light on this, I'd appreciate it.
Thanks
Caleb