[jdom-interest] Text class (Modified)

Ken Rune Helland kenh at csc.no
Mon May 28 07:03:35 PDT 2001

At 08:58 AM 5/28/2001 -0400, Elliotte Rusty Harold wrote:
>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.

The rationale in the other classes is that fields are proteced
so the subclass has the option to use the no argument constructor
and set the fields themself in their own constructor.

But here that the fields are private it seems pointless
to me to have a proteced noArg constuctor as there is no
other way to set the value field.


More information about the jdom-interest mailing list