[jdom-interest] Text class (Modified)
skeens
skeens at mobile.rogers.com
Sun May 27 18:48:38 PDT 2001
I'm thinking that getValue() is useless. Isn't toString() enough? They both do exactly the same thing. If you decide that it here to stay then I question whether toString() should be calling getValue() or vice versa. I have the feeling that most people will be calling toString() instead of getValue() to get its internal String value.
--
Steven D. Keens. mailto:skeens at planetfred.com
Planetfred Inc. http://www.planetfred.com/
-----Original Message-----
From: "Brett McLaughlin" <brett at newInstance.com>
Date: Sun, 27 May 2001 16:42:12 -0500
To: <jdom-interest at jdom.org>
Subject: [jdom-interest] Text class (Modified)
OK. So now we're at:
public class Text {
private StringBuffer value;
private Element parent;
protected Text() { }
public Text(String stringValue) {
value = new StringBuffer(stringValue);
}
public String getValue() {
return value.toString();
}
public void setValue(String stringValue) {
value = new StringBuffer(stringValue);
}
public void append(String stringValue) {
value.append(stringValue);
}
public Element getParent() {
return parent;
}
protected void setParent(Element parent) {
this.parent = parent;
}
public String toString() {
return getValue();
}
public int hashCode() {
return value.toString().hashCode();
}
public Object clone() {
Text newText = new Text(value);
newText.setParent(parent);
}
public boolean equals(Object ob) {
if (ob instanceof Text) {
if (((Text)ob).value.equals(value)) {
return true;
}
}
return false;
}
}
Anything else?
-Brett
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
More information about the jdom-interest
mailing list