[offtopic] RE: [jdom-interest] Text class

Matthew Mackenzie matt at xmlglobal.com
Sat May 26 18:40:46 PDT 2001


Forgive me if this is terribly naive, but does any one know why
java.lang.String* are final?  
 
-----Original Message----- 
From: Matthew Mackenzie on behalf of Matthew Mackenzie 
Sent: Sat 5/26/2001 5:40 PM 
To: Brett McLaughlin; jdom-interest at jdom.org 
Cc: 
Subject: RE: [jdom-interest] Text class



	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: 9006 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20010526/f510a9d2/attachment.bin


More information about the jdom-interest mailing list