[jdom-interest] getChildTextNormalize()

Laurent Bihanic laurent.bihanic at atosorigin.com
Wed Oct 3 01:08:43 PDT 2001

Kent C. Johnson wrote:

> I too agree it's bad to have methods in a parent that merely call 
> methods in a child.  However, there is something to be said for the 
> null-checking getChildText() does.  Since it doesn't just call 
> getChild().getText(), it can be said that it has it's own functionality, 
> namely returning "" if getChild() == null, and if not, returning the 
> wrap of getChild().getText().  Sounds a lot like a loop-hole too keep it 
> in, but that may be a good thing.  I think if everyone wanted the EXACT 
> right OOP way to do things, they might lean more towards DOM.  But it 
> seems to me (through my occasional use) that JDOM is more about 
> convenience.  Not convenience to the point of excessive clutter, but a 
> happy medium.

Having a helper class does not mean removing the convenience methods: The 
helper class may provide the actual implementation and the existing 
convenience methods will make use of the helper.

Adding a helper class may be a good answer to your question as it allows us to 
both provide convenience methods while not cluttering the interface of every 
object everytime someone needs a convenience method. It would also make it 
easier to agree on adding new convenience methods (such as my normalized text 
for Comment!).


More information about the jdom-interest mailing list