[jdom-interest] Text class (Modified)

Elliotte Rusty Harold elharo at metalab.unc.edu
Mon May 28 05:58:33 PDT 2001

At 4:42 PM -0500 5/27/01, Brett McLaughlin wrote:
>OK. So now we're at:
>public class Text {
>     private StringBuffer value;
>     private Element parent;
>     protected Text() { }

I guess I've never really understood why JDOM has these protected 
noargs constructors. A subclass of a Text is still a Text, and should 
still be able to rely on all the other public methods in the Text 
class. These methods will fail unexpectedly if this constructor is 
used. Why do we need this constructor at all. Why can't subclasses 
use the normal public constructor that does ask the caller to provide 
a String?

Same question for the other constructors like this in the other core classes.

| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
|                  The XML Bible (IDG Books, 1999)                   |
|              http://metalab.unc.edu/xml/books/bible/               |
|   http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/   |
|  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ |
|  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |

More information about the jdom-interest mailing list