commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <>
Subject Re: [configuration] How to edit a bean using apache.commons.configuration ....
Date Sat, 12 Feb 2011 15:37:07 GMT

Am 12.02.2011 15:58, schrieb Moein Enayati:
> Dear all
> I'm newly familiar with apache.commons and wondering of having an
> XML-Preferences file for my java applicaiton . till know I found
> apache.commons.configuration so useful in set/getproperties and also in
> getting a saved bean from xml resource.
> but I need to load a bean and apply user changes on it and save it again in
> its previous location in xml file.
> would you please help me is there any way to do so ?
> thanks/Moein

with "bean" you mean the bean declarations as described in the user's 
guide [1] I assume.

Well, basically a bean declaration is no different from normal 
properties defined in the XML document. This means you can use 
setProperty() with the corresponding keys to alter parts of the declaration.

Take the following example from the user's guide:

     <windowManager config-class=""
       closable="false" resizable="true" defaultWidth="400"
         backColor="#ffffff" foreColor="0080ff" iconName="myicon" />

If you want to change the backColor property of the style definition of 
the window manager bean, you could use the following call:




To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message