1 19 20 28 29 package org.netbeans.modules.xml.wsdl.ui.view.wizard; 30 31 public class WsdlElementType { 32 public static final String NAME = "Name"; public static final String EXTENSIONELEMENT = "ExtensionElement"; 35 private java.lang.String _Name; 36 private java.util.List _ExtensionElement = new java.util.ArrayList (); 38 41 public WsdlElementType() { 42 } 43 44 47 public WsdlElementType(org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType[] extensionElement) { 48 if (extensionElement!= null) { 49 ((java.util.ArrayList ) _ExtensionElement).ensureCapacity(extensionElement.length); 50 for (int i = 0; i < extensionElement.length; ++i) { 51 _ExtensionElement.add(extensionElement[i]); 52 } 53 } 54 } 55 56 59 public WsdlElementType(org.netbeans.modules.xml.wsdl.ui.view.wizard.WsdlElementType source) { 60 this(source, false); 61 } 62 63 67 public WsdlElementType(org.netbeans.modules.xml.wsdl.ui.view.wizard.WsdlElementType source, boolean justData) { 68 _Name = source._Name; 69 for (java.util.Iterator it = source._ExtensionElement.iterator(); 70 it.hasNext(); ) { 71 org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType srcElement = (org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType)it.next(); 72 _ExtensionElement.add((srcElement == null) ? null : newExtensionElementType(srcElement, justData)); 73 } 74 } 75 76 public void setName(java.lang.String value) { 78 _Name = value; 79 } 80 81 public java.lang.String getName() { 82 return _Name; 83 } 84 85 public void setExtensionElement(org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType[] value) { 87 if (value == null) 88 value = new ExtensionElementType[0]; 89 _ExtensionElement.clear(); 90 ((java.util.ArrayList ) _ExtensionElement).ensureCapacity(value.length); 91 for (int i = 0; i < value.length; ++i) { 92 _ExtensionElement.add(value[i]); 93 } 94 } 95 96 public void setExtensionElement(int index, org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType value) { 97 _ExtensionElement.set(index, value); 98 } 99 100 public org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType[] getExtensionElement() { 101 ExtensionElementType[] arr = new ExtensionElementType[_ExtensionElement.size()]; 102 return (ExtensionElementType[]) _ExtensionElement.toArray(arr); 103 } 104 105 public java.util.List fetchExtensionElementList() { 106 return _ExtensionElement; 107 } 108 109 public org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType getExtensionElement(int index) { 110 return (ExtensionElementType)_ExtensionElement.get(index); 111 } 112 113 public int sizeExtensionElement() { 115 return _ExtensionElement.size(); 116 } 117 118 public int addExtensionElement(org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType value) { 119 _ExtensionElement.add(value); 120 int positionOfNewItem = _ExtensionElement.size()-1; 121 return positionOfNewItem; 122 } 123 124 127 public int removeExtensionElement(org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType value) { 128 int pos = _ExtensionElement.indexOf(value); 129 if (pos >= 0) { 130 _ExtensionElement.remove(pos); 131 } 132 return pos; 133 } 134 135 139 public org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType newExtensionElementType() { 140 return new org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType(); 141 } 142 143 147 public org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType newExtensionElementType(ExtensionElementType source, boolean justData) { 148 return new org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType(source, justData); 149 } 150 151 public void writeNode(java.io.Writer out) throws java.io.IOException { 152 String myName; 153 myName = "wsdlElementType"; 154 writeNode(out, myName, ""); } 156 157 public void writeNode(java.io.Writer out, String nodeName, String indent) throws java.io.IOException { 158 writeNode(out, nodeName, null, indent, new java.util.HashMap ()); 159 } 160 161 164 public void writeNode(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException { 165 out.write(indent); 166 out.write("<"); 167 if (namespace != null) { 168 out.write((String )namespaceMap.get(namespace)); 169 out.write(":"); 170 } 171 out.write(nodeName); 172 writeNodeAttributes(out, nodeName, namespace, indent, namespaceMap); 173 out.write(">\n"); 174 writeNodeChildren(out, nodeName, namespace, indent, namespaceMap); 175 out.write(indent); 176 out.write("</"); 177 if (namespace != null) { 178 out.write((String )namespaceMap.get(namespace)); 179 out.write(":"); 180 } 181 out.write(nodeName); 182 out.write(">\n"); 183 } 184 185 protected void writeNodeAttributes(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException { 186 if (_Name != null) { 188 out.write(" name='"); 189 org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateGroup.writeXML(out, _Name, true); 190 out.write("'"); } 192 } 193 194 protected void writeNodeChildren(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException { 195 String nextIndent = indent + " "; 196 for (java.util.Iterator it = _ExtensionElement.iterator(); 197 it.hasNext(); ) { 198 org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType element = (org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType)it.next(); 199 if (element != null) { 200 element.writeNode(out, "extensionElement", null, nextIndent, namespaceMap); 201 } 202 } 203 } 204 205 public void readNode(org.w3c.dom.Node node) { 206 readNode(node, new java.util.HashMap ()); 207 } 208 209 public void readNode(org.w3c.dom.Node node, java.util.Map namespacePrefixes) { 210 if (node.hasAttributes()) { 211 org.w3c.dom.NamedNodeMap attrs = node.getAttributes(); 212 org.w3c.dom.Attr attr; 213 java.lang.String attrValue; 214 boolean firstNamespaceDef = true; 215 for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) { 216 attr = (org.w3c.dom.Attr ) attrs.item(attrNum); 217 String attrName = attr.getName(); 218 if (attrName.startsWith("xmlns:")) { 219 if (firstNamespaceDef) { 220 firstNamespaceDef = false; 221 namespacePrefixes = new java.util.HashMap (namespacePrefixes); 223 } 224 String attrNSPrefix = attrName.substring(6, attrName.length()); 225 namespacePrefixes.put(attrNSPrefix, attr.getValue()); 226 } 227 } 228 readNodeAttributes(node, namespacePrefixes, attrs); 229 } 230 readNodeChildren(node, namespacePrefixes); 231 } 232 233 protected void readNodeAttributes(org.w3c.dom.Node node, java.util.Map namespacePrefixes, org.w3c.dom.NamedNodeMap attrs) { 234 org.w3c.dom.Attr attr; 235 java.lang.String attrValue; 236 attr = (org.w3c.dom.Attr ) attrs.getNamedItem("name"); 237 if (attr != null) { 238 attrValue = attr.getValue(); 239 _Name = attrValue; 240 } 241 } 242 243 protected void readNodeChildren(org.w3c.dom.Node node, java.util.Map namespacePrefixes) { 244 org.w3c.dom.NodeList children = node.getChildNodes(); 245 for (int i = 0, size = children.getLength(); i < size; ++i) { 246 org.w3c.dom.Node childNode = children.item(i); 247 String childNodeName = (childNode.getLocalName() == null ? childNode.getNodeName().intern() : childNode.getLocalName().intern()); 248 String childNodeValue = ""; 249 if (childNode.getFirstChild() != null) { 250 childNodeValue = childNode.getFirstChild().getNodeValue(); 251 } 252 if (childNodeName == "extensionElement") { 253 ExtensionElementType aExtensionElement = newExtensionElementType(); 254 aExtensionElement.readNode(childNode, namespacePrefixes); 255 _ExtensionElement.add(aExtensionElement); 256 } 257 else { 258 } 260 } 261 } 262 263 public void changePropertyByName(String name, Object value) { 264 if (name == null) return; 265 name = name.intern(); 266 if (name == "name") 267 setName((java.lang.String )value); 268 else if (name == "extensionElement") 269 addExtensionElement((ExtensionElementType)value); 270 else if (name == "extensionElement[]") 271 setExtensionElement((ExtensionElementType[]) value); 272 else 273 throw new IllegalArgumentException (name+" is not a valid property name for WsdlElementType"); 274 } 275 276 public Object fetchPropertyByName(String name) { 277 if (name == "name") 278 return getName(); 279 if (name == "extensionElement[]") 280 return getExtensionElement(); 281 throw new IllegalArgumentException (name+" is not a valid property name for WsdlElementType"); 282 } 283 284 public String nameSelf() { 285 return "WsdlElementType"; 286 } 287 288 public String nameChild(Object childObj) { 289 return nameChild(childObj, false, false); 290 } 291 292 297 public String nameChild(Object childObj, boolean returnConstName, boolean returnSchemaName) { 298 return nameChild(childObj, returnConstName, returnSchemaName, false); 299 } 300 301 306 public String nameChild(Object childObj, boolean returnConstName, boolean returnSchemaName, boolean returnXPathName) { 307 if (childObj instanceof java.lang.String ) { 308 java.lang.String child = (java.lang.String ) childObj; 309 if (child == _Name) { 310 if (returnConstName) { 311 return NAME; 312 } else if (returnSchemaName) { 313 return "name"; 314 } else if (returnXPathName) { 315 return "@name"; 316 } else { 317 return "Name"; 318 } 319 } 320 } 321 if (childObj instanceof ExtensionElementType) { 322 ExtensionElementType child = (ExtensionElementType) childObj; 323 int index = 0; 324 for (java.util.Iterator it = _ExtensionElement.iterator(); 325 it.hasNext(); ) { 326 org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType element = (org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType)it.next(); 327 if (child == element) { 328 if (returnConstName) { 329 return EXTENSIONELEMENT; 330 } else if (returnSchemaName) { 331 return "extensionElement"; 332 } else if (returnXPathName) { 333 return "extensionElement[position()="+index+"]"; 334 } else { 335 return "ExtensionElement."+Integer.toHexString(index); 336 } 337 } 338 ++index; 339 } 340 } 341 return null; 342 } 343 344 347 public java.lang.Object [] childBeans(boolean recursive) { 348 java.util.List children = new java.util.LinkedList (); 349 childBeans(recursive, children); 350 java.lang.Object [] result = new java.lang.Object [children.size()]; 351 return (java.lang.Object []) children.toArray(result); 352 } 353 354 357 public void childBeans(boolean recursive, java.util.List beans) { 358 for (java.util.Iterator it = _ExtensionElement.iterator(); 359 it.hasNext(); ) { 360 org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType element = (org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType)it.next(); 361 if (element != null) { 362 if (recursive) { 363 element.childBeans(true, beans); 364 } 365 beans.add(element); 366 } 367 } 368 } 369 370 public boolean equals(Object o) { 371 return o instanceof org.netbeans.modules.xml.wsdl.ui.view.wizard.WsdlElementType && equals((org.netbeans.modules.xml.wsdl.ui.view.wizard.WsdlElementType) o); 372 } 373 374 public boolean equals(org.netbeans.modules.xml.wsdl.ui.view.wizard.WsdlElementType inst) { 375 if (inst == this) { 376 return true; 377 } 378 if (inst == null) { 379 return false; 380 } 381 if (!(_Name == null ? inst._Name == null : _Name.equals(inst._Name))) { 382 return false; 383 } 384 if (sizeExtensionElement() != inst.sizeExtensionElement()) 385 return false; 386 for (java.util.Iterator it = _ExtensionElement.iterator(), it2 = inst._ExtensionElement.iterator(); 388 it.hasNext() && it2.hasNext(); ) { 389 org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType element = (org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType)it.next(); 390 org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType element2 = (org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionElementType)it2.next(); 391 if (!(element == null ? element2 == null : element.equals(element2))) { 392 return false; 393 } 394 } 395 return true; 396 } 397 398 public int hashCode() { 399 int result = 17; 400 result = 37*result + (_Name == null ? 0 : _Name.hashCode()); 401 result = 37*result + (_ExtensionElement == null ? 0 : _ExtensionElement.hashCode()); 402 return result; 403 } 404 405 } 406 407 408 453 | Popular Tags |