Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 7 8 package org.dom4j.util; 9 10 import org.dom4j.Element; 11 import org.dom4j.QName; 12 import org.dom4j.tree.DefaultElement; 13 14 26 public class UserDataElement extends DefaultElement { 27 28 private Object data; 29 30 public UserDataElement(String name) { 31 super(name); 32 } 33 34 public UserDataElement(QName qname) { 35 super(qname); 36 } 37 38 public Object getData() { 39 return data; 40 } 41 42 public void setData(Object data) { 43 this.data = data; 44 } 45 46 public String toString() { 47 return super.toString() + " userData: " + data; 48 } 49 50 public Object clone() { 51 UserDataElement answer = (UserDataElement) super.clone(); 52 53 if (answer != this) { 54 answer.data = getCopyOfUserData(); 55 } 56 57 return answer; 58 } 59 60 63 70 protected Object getCopyOfUserData() { 71 return data; 72 } 73 74 protected Element createElement(String name) { 75 Element answer = getDocumentFactory().createElement(name); 76 answer.setData(getCopyOfUserData()); 77 78 return answer; 79 } 80 81 protected Element createElement(QName qName) { 82 Element answer = getDocumentFactory().createElement(qName); 83 answer.setData(getCopyOfUserData()); 84 85 return answer; 86 } 87 88 } 92 93 129
| Popular Tags
|