+1
On Mon, 12 Aug 2002 00:36, Marcus Crafter wrote:
> Hi All,
>
> Hope everyone is having a nice weekend! :)
>
> I'm working with a 3rd party library that uses
> java.util.Properties objects to store configuration data.
>
> I currently have a Framework Parameters object with the config data in
> it, and are atm manually converting it to a Properties object.
>
> I was thinking that this operation of converting a Parameters
> object to a Properties object was general enough to go into the
> Parameters class itself ?
>
> Something like:
>
> /**
> * Helper method to convert an Avalon Parameters object into a Java Util
> * Properties object.
> *
> * @param p a <code>Parameters</code> instance
> * @return a <code>Properties</code> instance
> */
> private Properties parametersToProperties(Parameters p)
> {
> Properties prop = new Properties();
> String[] names = p.getNames();
>
> for (int i = 0; i < names.length; ++i)
> {
> // "" is the default value, since getNames() proves it will exist
> prop.setProperty(names[i], p.getParameter(names[i], ""));
> }
>
> return prop;
> }
>
> Any thoughts ?
>
> Cheers,
>
> Marcus
--
Cheers,
Peter Donald
*------------------------------------------------*
| You can't wake a person who is pretending |
| to be asleep. -Navajo Proverb. |
*------------------------------------------------*
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>