avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@octo.com>
Subject RE: new method Configuration.containsAttribute() ?
Date Wed, 12 Dec 2001 21:47:29 GMT
Thanks Peter. Berin has already suggested this to me but I didn't like
too much as it was an indirect way of testing for existence, like using
Hashtable.get("key") == null instead of Hashtable.containsKey("key")
which better captures the intent. However, that will do for the time
being ... :-)

Cheers,
-Vincent

> -----Original Message-----
> From: Peter Royal [mailto:proyal@managingpartners.com]
> Sent: 12 December 2001 20:48
> To: Avalon Developers List
> Subject: Re: new method Configuration.containsAttribute() ?
> 
> On Wednesday 12 December 2001 03:37 pm, you wrote:
> > 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.
> 
> String value = configuration.getAttribute("attr", null);
> 
> if (value == null) {
> 	//there was no attribute
> } else if ("".equals(value)) {
> 	//exists but empty
> } else {
> 	//exists and non-empty
> }
> 
> -pete
> 
> --
> peter royal -> proyal@managingpartners.com
> 
> --
> To unsubscribe, e-mail:   <mailto:avalon-dev-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:avalon-dev-
> help@jakarta.apache.org>
> 




--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message