Colin Eberhardt wrote:
> Hi,
> 
> I am just starting out with using the commons configuration framework,
> and it seems to fulfill most of my needs. I am currently using it to
> populate JavaBeans from XML files. However, I have not worked out how to
> construct beans with collection relationship. The example given in the
> docs is as follows:
> 
> http://jakarta.apache.org/commons/configuration/howto_beans.html#Declaring_and_Creating_Beans
> 
> 
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <config>
>  <gui>
>    <windowManager config-class="examples.windows.DefaultWindowManager"
>      closable="false" resizable="true" defaultWidth="400"
>      defaultHeight="250">
>      <styleDefinition config-class="examples.windows.WindowStyleDefinition"
>        backColor="#ffffff" foreColor="0080ff" iconName="myicon" />
>    </windowManager>
>  </gui>
> </config>
> 
> What if the DefaultWindowManager class contained a collection of
> WindowStyleDefinition classes? Can the commons configuration populate
> such a bean?
> 
> If so, what is the format of the XML in this case?
> 
> Many Thanks,
> Colin E.
> 
Commons Configuration is not able to initialize a collection property of
a bean.

I think it would be possible to add such functionality, but I am not
sure whether we should do this because we would then enter the domain of
IoC containers like Spring or XML mapping frameworks (e.g. commons
betwix). The focus of Configuration lies in providing access to
configuration properties.

If you really need such advanced initialization features for beans, one
of the projects I mentioned above may be a better choice.

Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to