[jdom-interest] Text class (Modified)

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


At 4:42 PM -0500 5/27/01, Brett McLaughlin wrote:
>OK. So now we're at:
>
>public class Text {
>

implements Cloneable, Serializable

>     public Object clone() {
>         Text newText = new Text(value);
>         newText.setParent(parent);
>     }
>

I don't think the clone() method should set the parent because the 
clone is not a child of the parent (it's not in the parent's child 
list), unlike the original object. Clones generally appear detached.

-- 

+-----------------------+------------------------+-------------------+
| 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