Ok. Here is my use case : <configurationFactory>
<bundle id="short name1" [language="language1"] [country="Country1"]> /path/to/bundle1 </bundle> </configurationFactory> In the implementation code I'd like to take one action if no language/country are specified and another if they are (because behind the scenes I need to call an API which has 2 signatures, one with a Locale and one without - I don't want to get the default locale and only use the signature that accepts a locale as this would mean I override the default implementation of the API I'm referring to as I would introduce my own logic). I can imagine lots of cases where you would need to verify if an attribute exists because you may want to do something different if it does than if it does not. Ok about immutability :) Forget about hashtable. Isn't there an ImmutableHashtable in a utility class anywhere that would have the same API save for the write methods ? Thanks -Vincent > -----Original Message----- > From: Berin Loritsch [mailto:[EMAIL PROTECTED] > Sent: 12 December 2001 20:25 > To: Avalon Developers List > Subject: Re: new method Configuration.containsAttribute() ? > > Vincent Massol wrote: > > > > > ah, that's what I was missing. It never occurred to me that it was valid > > to pass a null value ! However, it does not seem a very nice way of > > doing it as it does not reflect what you're trying to achieve (checking > > if an attribute has been defined). > > > <snip/> > > > So, in conclusion, forget my previous proposition and instead, what > > would you think of : > > > > public Hashtable getAttributes(); > > > -1 > > The configuration API needs to remain immutable. You also still didn't > answer the question of *why* you needed to test if an attribute was > available. > > A component should be able to configure itself with default values, and > use the passed in Configuration object to override those defaults. If > you want to test for a missing attribute, I have to ask what it affords > you over defaulting your values. > > For instance, if you have a component that will run a background thread > depending on the value of an attribute, I would rather see something > like this: > > boolean bgThread = configuration.getAttributeAsBoolean("use-thread", > false); > > Do you see how that works? > > I am still trying to imagine *why* you need the attributeExists("use- > thread"); > type functionality. > > > -- > > "They that give up essential liberty to obtain a little temporary safety > deserve neither liberty nor safety." > - Benjamin Franklin > > > -- > To unsubscribe, e-mail: <mailto:avalon-dev- > [EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:avalon-dev- > [EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>