[jdom-interest] NoSuch*Exceptions in JDOM
James Davies
J.Davies at jacobus.co.uk
Mon Jul 10 06:06:16 PDT 2000
How's about naming the pair:
getChild
getChildOrNull
A rose by any other name?
Jim
-----------------------------------------------------------------
Dr James G. Davies
Jacobus Systems Limited, London UK
----- Original Message -----
From: "Andre Van Delft" <avandelft at epo.org>
To: <jdom-interest at jdom.org>
Cc: <alex at jguru.com>
Sent: Monday, July 10, 2000 1:29 PM
Subject: Re: [jdom-interest] NoSuch*Exceptions in JDOM
> Alex Chaffee wrote:
>
> > > We can have it both ways.
> > > I use a util function getChild that returns a null if the child is
> > > absent.
> > > I prefer the Element.getChild function to behave like this.
> > > The old Element.getChild functions throwing the exceptions may well be
> > > renamed into mustGetChild.
> > > That would do, IMHO.
> >
> > I'm with you. I like the terminology "mustX", but that breaks the
> > JavaBean convention of starting accesors with "get". But I think null
> > should be returned by the standard methods; Cornell&Horstmann (and
> > others) taught me not to overuse exceptions where a compare will do.
>
> Would the JavaBean convention forbid "mustGetChild"
> even if there is already a "getChild"?
> How about:
> getMandatoryChild - may throw NoSuch*Exception
> or
> getOptionalChild - may return null
>
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
More information about the jdom-interest
mailing list