[jdom-interest] Default for getChildText?

Garrett Zork zork263 at lycos.com
Wed Apr 3 12:57:41 PST 2002

I favor expanding the API slightly to include convenience
methods that every serious user would code on their own.

I understand that the API method-creep can be a problem.
On the other hand, most of the JDOM users I know have coded
the same convenience methods and placed them in utility
classes for their package.  

One of the convenience methods I had placed into a utility
class was the getAttributeValue with a default value, described
below.  Other methods that JDOM users commonly code into
a utility class include:

 - getIntAttributeValue and setIntAttribute value - also
   with a default value for the get.  While I certainly
   don't see the need for float/double/String versions of
   this, I don't need practice with parseInt and valueOf.
 - readDocument, writeDocument.  These would obviously fit 
   nicely in the Document class.

A good API is solid, stable and convenient not pretty.


On Wed, 03 Apr 2002 01:52:39  
 Jason Hunter wrote:
>Glad you like JDOM!
>The reason those methods don't exist is that those convenience methods
>aren't loved by all since they complicate the API, so while I pushed
>through getChildText() and getChildTextTrim() as convenience methods, I
>didn't want to push it.
>Dave Ferguson wrote:
>> I've recently started using JDOM and I love it.  Here is a question and possible enhancement request.
>> I noticed that beta 8 adds a new method to Element to get an attribute value while passing in a default -- getAttributeValue(String name, String def).  This is very helpful, but I was amazed to see that the same thing was not done for getChildText() and getChildTextTrim().  I would find it extremely useful to be able to pass a default to those methods as well.
>> Any reason those methods weren't added?
>> Thanks,
>> Dave F.
>> _______________________________________________
>> To control your jdom-interest membership:
>> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
>To control your jdom-interest membership:

See Dave Matthews Band live or win a signed guitar

More information about the jdom-interest mailing list