1 9 10 package org.uddi4j.datatype; 11 12 import org.uddi4j.UDDIElement; 13 import org.uddi4j.UDDIException; 14 import org.w3c.dom.Element ; 15 16 35 public class Description extends UDDIElement 36 { 37 public static final String UDDI_TAG = "description"; 38 39 protected Element base = null; 40 41 String text = null; 42 String lang = null; 43 44 50 public Description() 51 { 52 } 53 54 59 public Description(String value) 60 { 61 setText(value); 62 } 63 64 71 public Description(String value, String lang) 72 { 73 setText(value); 74 setLang(lang); 75 } 76 77 86 public Description(Element base) throws UDDIException 87 { 88 super(base); 90 text = getText(base); 91 lang = base.getAttribute("xml:lang"); 92 } 93 94 public void setText(String s) 95 { 96 text = s; 97 } 98 99 105 public void setLang(String s) 106 { 107 lang = s; 108 } 109 110 public String getText() 111 { 112 return text; 113 } 114 115 public String getLang() 116 { 117 return lang; 118 } 119 120 129 public void saveToXML(Element parent) 130 { 131 base = parent.getOwnerDocument().createElement(UDDI_TAG); 132 if (text != null) 134 { 135 base.appendChild(parent.getOwnerDocument().createTextNode(text)); 136 } 137 if ((lang != null) && !(lang.equals(""))) 138 { 139 base.setAttribute("xml:lang", lang); 140 } 141 parent.appendChild(base); 142 } 143 144 public boolean equals(Object object) 145 { 146 boolean result = false; 147 if (object != null && object instanceof Description) 148 { 149 Description otherDescription = (Description) object; 150 if ((this.text == null && otherDescription.text == null) || (this.text != null && this.text.equals(otherDescription.text))) 151 { 152 if ((this.lang == null && otherDescription.lang == null) || (this.lang != null && this.lang.equals(otherDescription.lang))) 154 { 155 result = true; 157 } 158 } 160 } 162 return result; 163 } 164 } 165 | Popular Tags |