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:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



Reply via email to