commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@oliver-heger.de>
Subject Re: [Configuration] Beans with Collection relationships
Date Thu, 17 May 2007 13:44:26 GMT
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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message