[jdom-interest] Text class

Matthew Mackenzie matt at xmlglobal.com
Sat May 26 17:40:32 PDT 2001


I think it would be neat to extend the StringBuffer class, just add
getValue()...
 
package org.jdom;
public class Text extends StringBuffer {
  public String getValue() {
    return super.toString();
  }
}
 
This way we get append() plus all of the other string manipulation calls
with little or no more overhead than simply encapsulating a StringBuffer
gives.
 
-Matt
 

	-----Original Message----- 
	From: Brett McLaughlin 
	Sent: Sat 5/26/2001 5:03 PM 
	To: jdom-interest at jdom.org 
	Cc: 
	Subject: [jdom-interest] Text class
	
	

	Here's where we're at:
	
	public class Text {
	
	    private StringBuffer value;
	
	    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 String toString() {
	        return getValue();
	    }
	
	    public int hashCode() {
	        return value.toString().hashCode();
	    }
	
	    // Leaving out impl for now on below here
	    public boolean equals(Object ob);
	
	}
	
	OK. Now we can discuss. What you think?
	
	-Brett
	
	_______________________________________________
	To control your jdom-interest membership:
	
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@you
rhost.com
	

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 5394 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20010526/2d5d0e98/attachment.bin


More information about the jdom-interest mailing list