[jdom-interest] About the Text class

phil at triloggroup.com phil at triloggroup.com
Fri Jan 11 12:17:29 PST 2002

Now that this class seems to be adopted, why not leveraging its capabilities.

First, the JDOM code is full of instanceof operator, checking for particular content.  Why not creating a base class
that will be the root of the other? Then, a "int getType()" method will be easier and faster than the use of instanceof.
a sanity check method can then be written like "return type=BaseClass.ELEMENT||BaseClass.Attribute".

Secundo, there're a lot of similitudes between CDATA and Text: they are both encapsulating a String. Why not having an
intermediate class that encapsulates the common functionnalities, then preventing the JDOM user for always checking for
a CDATA and a Text?


More information about the jdom-interest mailing list