It seems that with interfaces like ImmutableHierarchicalConfiguration one
should be able to use the configuration independent of the way in which it
is implemented.

>From the 
example(https://commons.apache.org/proper/commons-configuration/userguide/h
owto_beans.html#An_Example):

Parameters params = new Parameters();
FileBasedConfigurationBuilder<XMLConfiguration> builder =
    new 
FileBasedConfigurationBuilder<XMLConfiguration>(XMLConfiguration.class)
    .configure(params.xml()
        .setFileName("windowconfig.xml"));
XMLConfiguration config = builder.getConfiguration();
BeanDeclaration decl = new XMLBeanDeclaration(config, "gui.windowManager");
WindowManager wm = (WindowManager) BeanHelper.INSTANCE.createBean(decl);

It seems that in order to create a bean you must create a BeanDeclaration,
which seems to require knowledge of the implementation of the
configuration.

What if you had a method on ImmutableHierarchicalConfiguration (or
ImmutableConfiguration) such as:

   BeanDeclaration getBeanDeclaration(String key)

Then use would not be coupled to an implementation.

    ImmutableHierarchicalConfiguration config = ... Built any way you want
...
    BeanDeclaration decl = config.getBeanDeclaration("gui.windowManager");
    WindowManager wm = (WindowManager)
BeanHelper.INSTANCE.createBean(decl);


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to