1 19 26 27 package org.netbeans.modules.schema2beansdev.metadd; 28 29 public class MetaElement implements org.netbeans.modules.schema2beansdev.metadd.CommonBean { 30 public static final String DTD_NAME = "DtdName"; public static final String NAMESPACE = "Namespace"; public static final String BEAN_NAME = "BeanName"; public static final String BEAN_CLASS = "BeanClass"; public static final String WRAPPER_CLASS = "WrapperClass"; public static final String DEFAULT_VALUE = "DefaultValue"; public static final String KNOWN_VALUE = "KnownValue"; public static final String META_PROPERTY = "MetaProperty"; public static final String COMPARATOR_CLASS = "ComparatorClass"; public static final String IMPLEMENTS = "Implements"; public static final String EXTENDS = "Extends"; public static final String IMPORT = "Import"; public static final String USER_CODE = "UserCode"; public static final String VETOABLE = "Vetoable"; public static final String SKIP_GENERATION = "SkipGeneration"; public static final String DELEGATOR_NAME = "DelegatorName"; public static final String DELEGATOR_EXTENDS = "DelegatorExtends"; public static final String BEAN_INTERFACE_EXTENDS = "BeanInterfaceExtends"; public static final String CAN_BE_EMPTY = "CanBeEmpty"; 50 private String _DtdName; 51 private String _Namespace; 52 private String _BeanName; 53 private String _BeanClass; 54 private String _WrapperClass; 55 private java.util.List _DefaultValue = new java.util.ArrayList (); private java.util.List _KnownValue = new java.util.ArrayList (); private java.util.List _MetaProperty = new java.util.ArrayList (); private java.util.List _ComparatorClass = new java.util.ArrayList (); private String _Implements; 60 private String _Extends; 61 private java.util.List _Import = new java.util.ArrayList (); private String _UserCode; 63 private boolean _Vetoable; 64 private boolean _isSet_Vetoable = false; 65 private boolean _SkipGeneration; 66 private boolean _isSet_SkipGeneration = false; 67 private String _DelegatorName; 68 private String _DelegatorExtends; 69 private String _BeanInterfaceExtends; 70 private boolean _CanBeEmpty; 71 private boolean _isSet_CanBeEmpty = false; 72 73 76 public MetaElement() { 77 _DtdName = ""; 78 } 79 80 83 public MetaElement(String dtdName) { 84 _DtdName = dtdName; 85 } 86 87 90 public MetaElement(org.netbeans.modules.schema2beansdev.metadd.MetaElement source) { 91 this(source, false); 92 } 93 94 98 public MetaElement(org.netbeans.modules.schema2beansdev.metadd.MetaElement source, boolean justData) { 99 _DtdName = source._DtdName; 100 _Namespace = source._Namespace; 101 _BeanName = source._BeanName; 102 _BeanClass = source._BeanClass; 103 _WrapperClass = source._WrapperClass; 104 for (java.util.Iterator it = source._DefaultValue.iterator(); 105 it.hasNext(); ) { 106 String srcElement = (String )it.next(); 107 _DefaultValue.add(srcElement); 108 } 109 for (java.util.Iterator it = source._KnownValue.iterator(); 110 it.hasNext(); ) { 111 String srcElement = (String )it.next(); 112 _KnownValue.add(srcElement); 113 } 114 for (java.util.Iterator it = source._MetaProperty.iterator(); 115 it.hasNext(); ) { 116 org.netbeans.modules.schema2beansdev.metadd.MetaProperty srcElement = (org.netbeans.modules.schema2beansdev.metadd.MetaProperty)it.next(); 117 _MetaProperty.add((srcElement == null) ? null : newMetaProperty(srcElement, justData)); 118 } 119 for (java.util.Iterator it = source._ComparatorClass.iterator(); 120 it.hasNext(); ) { 121 String srcElement = (String )it.next(); 122 _ComparatorClass.add(srcElement); 123 } 124 _Implements = source._Implements; 125 _Extends = source._Extends; 126 for (java.util.Iterator it = source._Import.iterator(); 127 it.hasNext(); ) { 128 String srcElement = (String )it.next(); 129 _Import.add(srcElement); 130 } 131 _UserCode = source._UserCode; 132 _Vetoable = source._Vetoable; 133 _isSet_Vetoable = source._isSet_Vetoable; 134 _SkipGeneration = source._SkipGeneration; 135 _isSet_SkipGeneration = source._isSet_SkipGeneration; 136 _DelegatorName = source._DelegatorName; 137 _DelegatorExtends = source._DelegatorExtends; 138 _BeanInterfaceExtends = source._BeanInterfaceExtends; 139 _CanBeEmpty = source._CanBeEmpty; 140 _isSet_CanBeEmpty = source._isSet_CanBeEmpty; 141 } 142 143 public void setDtdName(String value) { 145 _DtdName = value; 146 } 147 148 public String getDtdName() { 149 return _DtdName; 150 } 151 152 public void setNamespace(String value) { 154 _Namespace = value; 155 } 156 157 public String getNamespace() { 158 return _Namespace; 159 } 160 161 public void setBeanName(String value) { 163 _BeanName = value; 164 } 165 166 public String getBeanName() { 167 return _BeanName; 168 } 169 170 public void setBeanClass(String value) { 172 _BeanClass = value; 173 } 174 175 public String getBeanClass() { 176 return _BeanClass; 177 } 178 179 public void setWrapperClass(String value) { 181 _WrapperClass = value; 182 } 183 184 public String getWrapperClass() { 185 return _WrapperClass; 186 } 187 188 public void setDefaultValue(String [] value) { 190 if (value == null) 191 value = new String [0]; 192 _DefaultValue.clear(); 193 ((java.util.ArrayList ) _DefaultValue).ensureCapacity(value.length); 194 for (int i = 0; i < value.length; ++i) { 195 _DefaultValue.add(value[i]); 196 } 197 } 198 199 public void setDefaultValue(int index, String value) { 200 _DefaultValue.set(index, value); 201 } 202 203 public String [] getDefaultValue() { 204 String [] arr = new String [_DefaultValue.size()]; 205 return (String []) _DefaultValue.toArray(arr); 206 } 207 208 public java.util.List fetchDefaultValueList() { 209 return _DefaultValue; 210 } 211 212 public String getDefaultValue(int index) { 213 return (String )_DefaultValue.get(index); 214 } 215 216 public int sizeDefaultValue() { 218 return _DefaultValue.size(); 219 } 220 221 public int addDefaultValue(String value) { 222 _DefaultValue.add(value); 223 int positionOfNewItem = _DefaultValue.size()-1; 224 return positionOfNewItem; 225 } 226 227 230 public int removeDefaultValue(String value) { 231 int pos = _DefaultValue.indexOf(value); 232 if (pos >= 0) { 233 _DefaultValue.remove(pos); 234 } 235 return pos; 236 } 237 238 public void setKnownValue(String [] value) { 240 if (value == null) 241 value = new String [0]; 242 _KnownValue.clear(); 243 ((java.util.ArrayList ) _KnownValue).ensureCapacity(value.length); 244 for (int i = 0; i < value.length; ++i) { 245 _KnownValue.add(value[i]); 246 } 247 } 248 249 public void setKnownValue(int index, String value) { 250 _KnownValue.set(index, value); 251 } 252 253 public String [] getKnownValue() { 254 String [] arr = new String [_KnownValue.size()]; 255 return (String []) _KnownValue.toArray(arr); 256 } 257 258 public java.util.List fetchKnownValueList() { 259 return _KnownValue; 260 } 261 262 public String getKnownValue(int index) { 263 return (String )_KnownValue.get(index); 264 } 265 266 public int sizeKnownValue() { 268 return _KnownValue.size(); 269 } 270 271 public int addKnownValue(String value) { 272 _KnownValue.add(value); 273 int positionOfNewItem = _KnownValue.size()-1; 274 return positionOfNewItem; 275 } 276 277 280 public int removeKnownValue(String value) { 281 int pos = _KnownValue.indexOf(value); 282 if (pos >= 0) { 283 _KnownValue.remove(pos); 284 } 285 return pos; 286 } 287 288 public void setMetaProperty(org.netbeans.modules.schema2beansdev.metadd.MetaProperty[] value) { 290 if (value == null) 291 value = new MetaProperty[0]; 292 _MetaProperty.clear(); 293 ((java.util.ArrayList ) _MetaProperty).ensureCapacity(value.length); 294 for (int i = 0; i < value.length; ++i) { 295 _MetaProperty.add(value[i]); 296 } 297 } 298 299 public void setMetaProperty(int index, org.netbeans.modules.schema2beansdev.metadd.MetaProperty value) { 300 _MetaProperty.set(index, value); 301 } 302 303 public org.netbeans.modules.schema2beansdev.metadd.MetaProperty[] getMetaProperty() { 304 MetaProperty[] arr = new MetaProperty[_MetaProperty.size()]; 305 return (MetaProperty[]) _MetaProperty.toArray(arr); 306 } 307 308 public java.util.List fetchMetaPropertyList() { 309 return _MetaProperty; 310 } 311 312 public org.netbeans.modules.schema2beansdev.metadd.MetaProperty getMetaProperty(int index) { 313 return (MetaProperty)_MetaProperty.get(index); 314 } 315 316 public int sizeMetaProperty() { 318 return _MetaProperty.size(); 319 } 320 321 public int addMetaProperty(org.netbeans.modules.schema2beansdev.metadd.MetaProperty value) { 322 _MetaProperty.add(value); 323 int positionOfNewItem = _MetaProperty.size()-1; 324 return positionOfNewItem; 325 } 326 327 330 public int removeMetaProperty(org.netbeans.modules.schema2beansdev.metadd.MetaProperty value) { 331 int pos = _MetaProperty.indexOf(value); 332 if (pos >= 0) { 333 _MetaProperty.remove(pos); 334 } 335 return pos; 336 } 337 338 public void setComparatorClass(String [] value) { 340 if (value == null) 341 value = new String [0]; 342 _ComparatorClass.clear(); 343 ((java.util.ArrayList ) _ComparatorClass).ensureCapacity(value.length); 344 for (int i = 0; i < value.length; ++i) { 345 _ComparatorClass.add(value[i]); 346 } 347 } 348 349 public void setComparatorClass(int index, String value) { 350 _ComparatorClass.set(index, value); 351 } 352 353 public String [] getComparatorClass() { 354 String [] arr = new String [_ComparatorClass.size()]; 355 return (String []) _ComparatorClass.toArray(arr); 356 } 357 358 public java.util.List fetchComparatorClassList() { 359 return _ComparatorClass; 360 } 361 362 public String getComparatorClass(int index) { 363 return (String )_ComparatorClass.get(index); 364 } 365 366 public int sizeComparatorClass() { 368 return _ComparatorClass.size(); 369 } 370 371 public int addComparatorClass(String value) { 372 _ComparatorClass.add(value); 373 int positionOfNewItem = _ComparatorClass.size()-1; 374 return positionOfNewItem; 375 } 376 377 380 public int removeComparatorClass(String value) { 381 int pos = _ComparatorClass.indexOf(value); 382 if (pos >= 0) { 383 _ComparatorClass.remove(pos); 384 } 385 return pos; 386 } 387 388 public void setImplements(String value) { 390 _Implements = value; 391 } 392 393 public String getImplements() { 394 return _Implements; 395 } 396 397 public void setExtends(String value) { 399 _Extends = value; 400 } 401 402 public String getExtends() { 403 return _Extends; 404 } 405 406 public void setImport(String [] value) { 408 if (value == null) 409 value = new String [0]; 410 _Import.clear(); 411 ((java.util.ArrayList ) _Import).ensureCapacity(value.length); 412 for (int i = 0; i < value.length; ++i) { 413 _Import.add(value[i]); 414 } 415 } 416 417 public void setImport(int index, String value) { 418 _Import.set(index, value); 419 } 420 421 public String [] getImport() { 422 String [] arr = new String [_Import.size()]; 423 return (String []) _Import.toArray(arr); 424 } 425 426 public java.util.List fetchImportList() { 427 return _Import; 428 } 429 430 public String getImport(int index) { 431 return (String )_Import.get(index); 432 } 433 434 public int sizeImport() { 436 return _Import.size(); 437 } 438 439 public int addImport(String value) { 440 _Import.add(value); 441 int positionOfNewItem = _Import.size()-1; 442 return positionOfNewItem; 443 } 444 445 448 public int removeImport(String value) { 449 int pos = _Import.indexOf(value); 450 if (pos >= 0) { 451 _Import.remove(pos); 452 } 453 return pos; 454 } 455 456 public void setUserCode(String value) { 458 _UserCode = value; 459 } 460 461 public String getUserCode() { 462 return _UserCode; 463 } 464 465 public void setVetoable(boolean value) { 467 _Vetoable = value; 468 _isSet_Vetoable = true; 469 } 470 471 public boolean isVetoable() { 472 return _Vetoable; 473 } 474 475 public void setSkipGeneration(boolean value) { 477 _SkipGeneration = value; 478 _isSet_SkipGeneration = true; 479 } 480 481 public boolean isSkipGeneration() { 482 return _SkipGeneration; 483 } 484 485 public void setDelegatorName(String value) { 487 _DelegatorName = value; 488 } 489 490 public String getDelegatorName() { 491 return _DelegatorName; 492 } 493 494 public void setDelegatorExtends(String value) { 496 _DelegatorExtends = value; 497 } 498 499 public String getDelegatorExtends() { 500 return _DelegatorExtends; 501 } 502 503 public void setBeanInterfaceExtends(String value) { 505 _BeanInterfaceExtends = value; 506 } 507 508 public String getBeanInterfaceExtends() { 509 return _BeanInterfaceExtends; 510 } 511 512 public void setCanBeEmpty(boolean value) { 514 _CanBeEmpty = value; 515 _isSet_CanBeEmpty = true; 516 } 517 518 public boolean isCanBeEmpty() { 519 return _CanBeEmpty; 520 } 521 522 526 public org.netbeans.modules.schema2beansdev.metadd.MetaProperty newMetaProperty() { 527 return new org.netbeans.modules.schema2beansdev.metadd.MetaProperty(); 528 } 529 530 534 public org.netbeans.modules.schema2beansdev.metadd.MetaProperty newMetaProperty(MetaProperty source, boolean justData) { 535 return new org.netbeans.modules.schema2beansdev.metadd.MetaProperty(source, justData); 536 } 537 538 public void writeNode(java.io.Writer out) throws java.io.IOException { 539 String myName; 540 myName = "meta-element"; 541 writeNode(out, myName, ""); } 543 544 public void writeNode(java.io.Writer out, String nodeName, String indent) throws java.io.IOException { 545 writeNode(out, nodeName, null, indent, new java.util.HashMap ()); 546 } 547 548 551 public void writeNode(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException { 552 out.write(indent); 553 out.write("<"); 554 if (namespace != null) { 555 out.write((String )namespaceMap.get(namespace)); 556 out.write(":"); 557 } 558 out.write(nodeName); 559 out.write(">\n"); 560 String nextIndent = indent + " "; 561 if (_DtdName != null) { 562 out.write(nextIndent); 563 out.write("<dtd-name"); out.write(">"); org.netbeans.modules.schema2beansdev.metadd.MetaDD.writeXML(out, _DtdName, false); 566 out.write("</dtd-name>\n"); } 568 if (_Namespace != null) { 569 out.write(nextIndent); 570 out.write("<namespace"); out.write(">"); org.netbeans.modules.schema2beansdev.metadd.MetaDD.writeXML(out, _Namespace, false); 573 out.write("</namespace>\n"); } 575 if (_BeanName != null) { 576 out.write(nextIndent); 577 out.write("<bean-name"); out.write(">"); org.netbeans.modules.schema2beansdev.metadd.MetaDD.writeXML(out, _BeanName, false); 580 out.write("</bean-name>\n"); } 582 if (_BeanClass != null) { 583 out.write(nextIndent); 584 out.write("<bean-class"); out.write(">"); org.netbeans.modules.schema2beansdev.metadd.MetaDD.writeXML(out, _BeanClass, false); 587 out.write("</bean-class>\n"); } 589 if (_WrapperClass != null) { 590 out.write(nextIndent); 591 out.write("<wrapper-class"); out.write(">"); org.netbeans.modules.schema2beansdev.metadd.MetaDD.writeXML(out, _WrapperClass, false); 594 out.write("</wrapper-class>\n"); } 596 for (java.util.Iterator it = _DefaultValue.iterator(); 597 it.hasNext(); ) { 598 String element = (String )it.next(); 599 if (element != null) { 600 out.write(nextIndent); 601 out.write("<default-value"); out.write(">"); org.netbeans.modules.schema2beansdev.metadd.MetaDD.writeXML(out, element, false); 604 out.write("</default-value>\n"); } 606 } 607 for (java.util.Iterator it = _KnownValue.iterator(); it.hasNext(); 608 ) { 609 String element = (String )it.next(); 610 if (element != null) { 611 out.write(nextIndent); 612 out.write("<known-value"); out.write(">"); org.netbeans.modules.schema2beansdev.metadd.MetaDD.writeXML(out, element, false); 615 out.write("</known-value>\n"); } 617 } 618 for (java.util.Iterator it = _MetaProperty.iterator(); 619 it.hasNext(); ) { 620 org.netbeans.modules.schema2beansdev.metadd.MetaProperty element = (org.netbeans.modules.schema2beansdev.metadd.MetaProperty)it.next(); 621 if (element != null) { 622 element.writeNode(out, "meta-property", null, nextIndent, namespaceMap); 623 } 624 } 625 for (java.util.Iterator it = _ComparatorClass.iterator(); 626 it.hasNext(); ) { 627 String element = (String )it.next(); 628 if (element != null) { 629 out.write(nextIndent); 630 out.write("<comparator-class"); out.write(">"); org.netbeans.modules.schema2beansdev.metadd.MetaDD.writeXML(out, element, false); 633 out.write("</comparator-class>\n"); } 635 } 636 if (_Implements != null) { 637 out.write(nextIndent); 638 out.write("<implements"); out.write(">"); org.netbeans.modules.schema2beansdev.metadd.MetaDD.writeXML(out, _Implements, false); 641 out.write("</implements>\n"); } 643 if (_Extends != null) { 644 out.write(nextIndent); 645 out.write("<extends"); out.write(">"); org.netbeans.modules.schema2beansdev.metadd.MetaDD.writeXML(out, _Extends, false); 648 out.write("</extends>\n"); } 650 for (java.util.Iterator it = _Import.iterator(); it.hasNext(); ) { 651 String element = (String )it.next(); 652 if (element != null) { 653 out.write(nextIndent); 654 out.write("<import"); out.write(">"); org.netbeans.modules.schema2beansdev.metadd.MetaDD.writeXML(out, element, false); 657 out.write("</import>\n"); } 659 } 660 if (_UserCode != null) { 661 out.write(nextIndent); 662 out.write("<user-code"); out.write(">"); org.netbeans.modules.schema2beansdev.metadd.MetaDD.writeXML(out, _UserCode, false); 665 out.write("</user-code>\n"); } 667 if (_isSet_Vetoable) { 668 if (_Vetoable) { 669 out.write(nextIndent); 670 out.write("<vetoable"); out.write("/>\n"); } 673 } 674 if (_isSet_SkipGeneration) { 675 if (_SkipGeneration) { 676 out.write(nextIndent); 677 out.write("<skip-generation"); out.write("/>\n"); } 680 } 681 if (_DelegatorName != null) { 682 out.write(nextIndent); 683 out.write("<delegator-name"); out.write(">"); org.netbeans.modules.schema2beansdev.metadd.MetaDD.writeXML(out, _DelegatorName, false); 686 out.write("</delegator-name>\n"); } 688 if (_DelegatorExtends != null) { 689 out.write(nextIndent); 690 out.write("<delegator-extends"); out.write(">"); org.netbeans.modules.schema2beansdev.metadd.MetaDD.writeXML(out, _DelegatorExtends, false); 693 out.write("</delegator-extends>\n"); } 695 if (_BeanInterfaceExtends != null) { 696 out.write(nextIndent); 697 out.write("<bean-interface-extends"); out.write(">"); org.netbeans.modules.schema2beansdev.metadd.MetaDD.writeXML(out, _BeanInterfaceExtends, false); 700 out.write("</bean-interface-extends>\n"); } 702 if (_isSet_CanBeEmpty) { 703 if (_CanBeEmpty) { 704 out.write(nextIndent); 705 out.write("<can-be-empty"); out.write("/>\n"); } 708 } 709 out.write(indent); 710 out.write("</"); 711 if (namespace != null) { 712 out.write((String )namespaceMap.get(namespace)); 713 out.write(":"); 714 } 715 out.write(nodeName); 716 out.write(">\n"); 717 } 718 719 public void readNode(org.w3c.dom.Node node) { 720 readNode(node, new java.util.HashMap ()); 721 } 722 723 public void readNode(org.w3c.dom.Node node, java.util.Map namespacePrefixes) { 724 if (node.hasAttributes()) { 725 org.w3c.dom.NamedNodeMap attrs = node.getAttributes(); 726 org.w3c.dom.Attr attr; 727 java.lang.String attrValue; 728 boolean firstNamespaceDef = true; 729 for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) { 730 attr = (org.w3c.dom.Attr ) attrs.item(attrNum); 731 String attrName = attr.getName(); 732 if (attrName.startsWith("xmlns:")) { 733 if (firstNamespaceDef) { 734 firstNamespaceDef = false; 735 namespacePrefixes = new java.util.HashMap (namespacePrefixes); 737 } 738 String attrNSPrefix = attrName.substring(6, attrName.length()); 739 namespacePrefixes.put(attrNSPrefix, attr.getValue()); 740 } 741 } 742 } 743 org.w3c.dom.NodeList children = node.getChildNodes(); 744 for (int i = 0, size = children.getLength(); i < size; ++i) { 745 org.w3c.dom.Node childNode = children.item(i); 746 String childNodeName = (childNode.getLocalName() == null ? childNode.getNodeName().intern() : childNode.getLocalName().intern()); 747 String childNodeValue = ""; 748 if (childNode.getFirstChild() != null) { 749 childNodeValue = childNode.getFirstChild().getNodeValue(); 750 } 751 if (childNodeName == "dtd-name") { 752 _DtdName = childNodeValue; 753 } 754 else if (childNodeName == "namespace") { 755 _Namespace = childNodeValue; 756 } 757 else if (childNodeName == "bean-name") { 758 _BeanName = childNodeValue; 759 } 760 else if (childNodeName == "bean-class") { 761 _BeanClass = childNodeValue; 762 } 763 else if (childNodeName == "wrapper-class") { 764 _WrapperClass = childNodeValue; 765 } 766 else if (childNodeName == "default-value") { 767 String aDefaultValue; 768 aDefaultValue = childNodeValue; 769 _DefaultValue.add(aDefaultValue); 770 } 771 else if (childNodeName == "known-value") { 772 String aKnownValue; 773 aKnownValue = childNodeValue; 774 _KnownValue.add(aKnownValue); 775 } 776 else if (childNodeName == "meta-property") { 777 MetaProperty aMetaProperty = newMetaProperty(); 778 aMetaProperty.readNode(childNode, namespacePrefixes); 779 _MetaProperty.add(aMetaProperty); 780 } 781 else if (childNodeName == "comparator-class") { 782 String aComparatorClass; 783 aComparatorClass = childNodeValue; 784 _ComparatorClass.add(aComparatorClass); 785 } 786 else if (childNodeName == "implements") { 787 _Implements = childNodeValue; 788 } 789 else if (childNodeName == "extends") { 790 _Extends = childNodeValue; 791 } 792 else if (childNodeName == "import") { 793 String aImport; 794 aImport = childNodeValue; 795 _Import.add(aImport); 796 } 797 else if (childNodeName == "user-code") { 798 _UserCode = childNodeValue; 799 } 800 else if (childNodeName == "vetoable") { 801 if (childNode.getFirstChild() == null) 802 _Vetoable = true; 803 else 804 _Vetoable = java.lang.Boolean.valueOf(childNodeValue).booleanValue(); 805 _isSet_Vetoable = true; 806 } 807 else if (childNodeName == "skip-generation") { 808 if (childNode.getFirstChild() == null) 809 _SkipGeneration = true; 810 else 811 _SkipGeneration = java.lang.Boolean.valueOf(childNodeValue).booleanValue(); 812 _isSet_SkipGeneration = true; 813 } 814 else if (childNodeName == "delegator-name") { 815 _DelegatorName = childNodeValue; 816 } 817 else if (childNodeName == "delegator-extends") { 818 _DelegatorExtends = childNodeValue; 819 } 820 else if (childNodeName == "bean-interface-extends") { 821 _BeanInterfaceExtends = childNodeValue; 822 } 823 else if (childNodeName == "can-be-empty") { 824 if (childNode.getFirstChild() == null) 825 _CanBeEmpty = true; 826 else 827 _CanBeEmpty = java.lang.Boolean.valueOf(childNodeValue).booleanValue(); 828 _isSet_CanBeEmpty = true; 829 } 830 else { 831 } 833 } 834 } 835 836 public void validate() throws org.netbeans.modules.schema2beansdev.metadd.MetaDD.ValidateException { 837 boolean restrictionFailure = false; 838 boolean restrictionPassed = false; 839 if (getDtdName() == null) { 841 throw new org.netbeans.modules.schema2beansdev.metadd.MetaDD.ValidateException("getDtdName() == null", org.netbeans.modules.schema2beansdev.metadd.MetaDD.ValidateException.FailureType.NULL_VALUE, "dtdName", this); } 843 for (int _index = 0; _index < sizeMetaProperty(); ++_index) { 851 org.netbeans.modules.schema2beansdev.metadd.MetaProperty element = getMetaProperty(_index); 852 if (element != null) { 853 element.validate(); 854 } 855 } 856 } 868 869 public void changePropertyByName(String name, Object value) { 870 if (name == null) return; 871 name = name.intern(); 872 if (name == "dtdName") 873 setDtdName((String )value); 874 else if (name == "namespace") 875 setNamespace((String )value); 876 else if (name == "beanName") 877 setBeanName((String )value); 878 else if (name == "beanClass") 879 setBeanClass((String )value); 880 else if (name == "wrapperClass") 881 setWrapperClass((String )value); 882 else if (name == "defaultValue") 883 addDefaultValue((String )value); 884 else if (name == "defaultValue[]") 885 setDefaultValue((String []) value); 886 else if (name == "knownValue") 887 addKnownValue((String )value); 888 else if (name == "knownValue[]") 889 setKnownValue((String []) value); 890 else if (name == "metaProperty") 891 addMetaProperty((MetaProperty)value); 892 else if (name == "metaProperty[]") 893 setMetaProperty((MetaProperty[]) value); 894 else if (name == "comparatorClass") 895 addComparatorClass((String )value); 896 else if (name == "comparatorClass[]") 897 setComparatorClass((String []) value); 898 else if (name == "implements") 899 setImplements((String )value); 900 else if (name == "extends") 901 setExtends((String )value); 902 else if (name == "import") 903 addImport((String )value); 904 else if (name == "import[]") 905 setImport((String []) value); 906 else if (name == "userCode") 907 setUserCode((String )value); 908 else if (name == "vetoable") 909 setVetoable(((java.lang.Boolean )value).booleanValue()); 910 else if (name == "skipGeneration") 911 setSkipGeneration(((java.lang.Boolean )value).booleanValue()); 912 else if (name == "delegatorName") 913 setDelegatorName((String )value); 914 else if (name == "delegatorExtends") 915 setDelegatorExtends((String )value); 916 else if (name == "beanInterfaceExtends") 917 setBeanInterfaceExtends((String )value); 918 else if (name == "canBeEmpty") 919 setCanBeEmpty(((java.lang.Boolean )value).booleanValue()); 920 else 921 throw new IllegalArgumentException (name+" is not a valid property name for MetaElement"); 922 } 923 924 public Object fetchPropertyByName(String name) { 925 if (name == "dtdName") 926 return getDtdName(); 927 if (name == "namespace") 928 return getNamespace(); 929 if (name == "beanName") 930 return getBeanName(); 931 if (name == "beanClass") 932 return getBeanClass(); 933 if (name == "wrapperClass") 934 return getWrapperClass(); 935 if (name == "defaultValue[]") 936 return getDefaultValue(); 937 if (name == "knownValue[]") 938 return getKnownValue(); 939 if (name == "metaProperty[]") 940 return getMetaProperty(); 941 if (name == "comparatorClass[]") 942 return getComparatorClass(); 943 if (name == "implements") 944 return getImplements(); 945 if (name == "extends") 946 return getExtends(); 947 if (name == "import[]") 948 return getImport(); 949 if (name == "userCode") 950 return getUserCode(); 951 if (name == "vetoable") 952 return (isVetoable() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); 953 if (name == "skipGeneration") 954 return (isSkipGeneration() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); 955 if (name == "delegatorName") 956 return getDelegatorName(); 957 if (name == "delegatorExtends") 958 return getDelegatorExtends(); 959 if (name == "beanInterfaceExtends") 960 return getBeanInterfaceExtends(); 961 if (name == "canBeEmpty") 962 return (isCanBeEmpty() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); 963 throw new IllegalArgumentException (name+" is not a valid property name for MetaElement"); 964 } 965 966 public String nameSelf() { 967 return "MetaElement"; 968 } 969 970 public String nameChild(Object childObj) { 971 return nameChild(childObj, false, false); 972 } 973 974 979 public String nameChild(Object childObj, boolean returnConstName, boolean returnSchemaName) { 980 return nameChild(childObj, returnConstName, returnSchemaName, false); 981 } 982 983 988 public String nameChild(Object childObj, boolean returnConstName, boolean returnSchemaName, boolean returnXPathName) { 989 if (childObj instanceof java.lang.String ) { 990 java.lang.String child = (java.lang.String ) childObj; 991 if (child == _DtdName) { 992 if (returnConstName) { 993 return DTD_NAME; 994 } else if (returnSchemaName) { 995 return "dtd-name"; 996 } else if (returnXPathName) { 997 return "dtd-name"; 998 } else { 999 return "DtdName"; 1000 } 1001 } 1002 if (child == _Namespace) { 1003 if (returnConstName) { 1004 return NAMESPACE; 1005 } else if (returnSchemaName) { 1006 return "namespace"; 1007 } else if (returnXPathName) { 1008 return "namespace"; 1009 } else { 1010 return "Namespace"; 1011 } 1012 } 1013 if (child == _BeanName) { 1014 if (returnConstName) { 1015 return BEAN_NAME; 1016 } else if (returnSchemaName) { 1017 return "bean-name"; 1018 } else if (returnXPathName) { 1019 return "bean-name"; 1020 } else { 1021 return "BeanName"; 1022 } 1023 } 1024 if (child == _BeanClass) { 1025 if (returnConstName) { 1026 return BEAN_CLASS; 1027 } else if (returnSchemaName) { 1028 return "bean-class"; 1029 } else if (returnXPathName) { 1030 return "bean-class"; 1031 } else { 1032 return "BeanClass"; 1033 } 1034 } 1035 if (child == _WrapperClass) { 1036 if (returnConstName) { 1037 return WRAPPER_CLASS; 1038 } else if (returnSchemaName) { 1039 return "wrapper-class"; 1040 } else if (returnXPathName) { 1041 return "wrapper-class"; 1042 } else { 1043 return "WrapperClass"; 1044 } 1045 } 1046 int index = 0; 1047 for (java.util.Iterator it = _DefaultValue.iterator(); 1048 it.hasNext(); ) { 1049 String element = (String )it.next(); 1050 if (child == element) { 1051 if (returnConstName) { 1052 return DEFAULT_VALUE; 1053 } else if (returnSchemaName) { 1054 return "default-value"; 1055 } else if (returnXPathName) { 1056 return "default-value[position()="+index+"]"; 1057 } else { 1058 return "DefaultValue."+Integer.toHexString(index); 1059 } 1060 } 1061 ++index; 1062 } 1063 index = 0; 1064 for (java.util.Iterator it = _KnownValue.iterator(); 1065 it.hasNext(); ) { 1066 String element = (String )it.next(); 1067 if (child == element) { 1068 if (returnConstName) { 1069 return KNOWN_VALUE; 1070 } else if (returnSchemaName) { 1071 return "known-value"; 1072 } else if (returnXPathName) { 1073 return "known-value[position()="+index+"]"; 1074 } else { 1075 return "KnownValue."+Integer.toHexString(index); 1076 } 1077 } 1078 ++index; 1079 } 1080 index = 0; 1081 for (java.util.Iterator it = _ComparatorClass.iterator(); 1082 it.hasNext(); ) { 1083 String element = (String )it.next(); 1084 if (child == element) { 1085 if (returnConstName) { 1086 return COMPARATOR_CLASS; 1087 } else if (returnSchemaName) { 1088 return "comparator-class"; 1089 } else if (returnXPathName) { 1090 return "comparator-class[position()="+index+"]"; 1091 } else { 1092 return "ComparatorClass."+Integer.toHexString(index); 1093 } 1094 } 1095 ++index; 1096 } 1097 if (child == _Implements) { 1098 if (returnConstName) { 1099 return IMPLEMENTS; 1100 } else if (returnSchemaName) { 1101 return "implements"; 1102 } else if (returnXPathName) { 1103 return "implements"; 1104 } else { 1105 return "Implements"; 1106 } 1107 } 1108 if (child == _Extends) { 1109 if (returnConstName) { 1110 return EXTENDS; 1111 } else if (returnSchemaName) { 1112 return "extends"; 1113 } else if (returnXPathName) { 1114 return "extends"; 1115 } else { 1116 return "Extends"; 1117 } 1118 } 1119 index = 0; 1120 for (java.util.Iterator it = _Import.iterator(); it.hasNext(); 1121 ) { 1122 String element = (String )it.next(); 1123 if (child == element) { 1124 if (returnConstName) { 1125 return IMPORT; 1126 } else if (returnSchemaName) { 1127 return "import"; 1128 } else if (returnXPathName) { 1129 return "import[position()="+index+"]"; 1130 } else { 1131 return "Import."+Integer.toHexString(index); 1132 } 1133 } 1134 ++index; 1135 } 1136 if (child == _UserCode) { 1137 if (returnConstName) { 1138 return USER_CODE; 1139 } else if (returnSchemaName) { 1140 return "user-code"; 1141 } else if (returnXPathName) { 1142 return "user-code"; 1143 } else { 1144 return "UserCode"; 1145 } 1146 } 1147 if (child == _DelegatorName) { 1148 if (returnConstName) { 1149 return DELEGATOR_NAME; 1150 } else if (returnSchemaName) { 1151 return "delegator-name"; 1152 } else if (returnXPathName) { 1153 return "delegator-name"; 1154 } else { 1155 return "DelegatorName"; 1156 } 1157 } 1158 if (child == _DelegatorExtends) { 1159 if (returnConstName) { 1160 return DELEGATOR_EXTENDS; 1161 } else if (returnSchemaName) { 1162 return "delegator-extends"; 1163 } else if (returnXPathName) { 1164 return "delegator-extends"; 1165 } else { 1166 return "DelegatorExtends"; 1167 } 1168 } 1169 if (child == _BeanInterfaceExtends) { 1170 if (returnConstName) { 1171 return BEAN_INTERFACE_EXTENDS; 1172 } else if (returnSchemaName) { 1173 return "bean-interface-extends"; 1174 } else if (returnXPathName) { 1175 return "bean-interface-extends"; 1176 } else { 1177 return "BeanInterfaceExtends"; 1178 } 1179 } 1180 } 1181 if (childObj instanceof MetaProperty) { 1182 MetaProperty child = (MetaProperty) childObj; 1183 int index = 0; 1184 for (java.util.Iterator it = _MetaProperty.iterator(); 1185 it.hasNext(); ) { 1186 org.netbeans.modules.schema2beansdev.metadd.MetaProperty element = (org.netbeans.modules.schema2beansdev.metadd.MetaProperty)it.next(); 1187 if (child == element) { 1188 if (returnConstName) { 1189 return META_PROPERTY; 1190 } else if (returnSchemaName) { 1191 return "meta-property"; 1192 } else if (returnXPathName) { 1193 return "meta-property[position()="+index+"]"; 1194 } else { 1195 return "MetaProperty."+Integer.toHexString(index); 1196 } 1197 } 1198 ++index; 1199 } 1200 } 1201 if (childObj instanceof java.lang.Boolean ) { 1202 java.lang.Boolean child = (java.lang.Boolean ) childObj; 1203 if (((java.lang.Boolean )child).booleanValue() == _Vetoable) { 1204 if (returnConstName) { 1205 return VETOABLE; 1206 } else if (returnSchemaName) { 1207 return "vetoable"; 1208 } else if (returnXPathName) { 1209 return "vetoable"; 1210 } else { 1211 return "Vetoable"; 1212 } 1213 } 1214 if (((java.lang.Boolean )child).booleanValue() == _SkipGeneration) { 1215 if (returnConstName) { 1216 return SKIP_GENERATION; 1217 } else if (returnSchemaName) { 1218 return "skip-generation"; 1219 } else if (returnXPathName) { 1220 return "skip-generation"; 1221 } else { 1222 return "SkipGeneration"; 1223 } 1224 } 1225 if (((java.lang.Boolean )child).booleanValue() == _CanBeEmpty) { 1226 if (returnConstName) { 1227 return CAN_BE_EMPTY; 1228 } else if (returnSchemaName) { 1229 return "can-be-empty"; 1230 } else if (returnXPathName) { 1231 return "can-be-empty"; 1232 } else { 1233 return "CanBeEmpty"; 1234 } 1235 } 1236 } 1237 return null; 1238 } 1239 1240 1243 public org.netbeans.modules.schema2beansdev.metadd.CommonBean[] childBeans(boolean recursive) { 1244 java.util.List children = new java.util.LinkedList (); 1245 childBeans(recursive, children); 1246 org.netbeans.modules.schema2beansdev.metadd.CommonBean[] result = new org.netbeans.modules.schema2beansdev.metadd.CommonBean[children.size()]; 1247 return (org.netbeans.modules.schema2beansdev.metadd.CommonBean[]) children.toArray(result); 1248 } 1249 1250 1253 public void childBeans(boolean recursive, java.util.List beans) { 1254 for (java.util.Iterator it = _MetaProperty.iterator(); 1255 it.hasNext(); ) { 1256 org.netbeans.modules.schema2beansdev.metadd.MetaProperty element = (org.netbeans.modules.schema2beansdev.metadd.MetaProperty)it.next(); 1257 if (element != null) { 1258 if (recursive) { 1259 element.childBeans(true, beans); 1260 } 1261 beans.add(element); 1262 } 1263 } 1264 } 1265 1266 public boolean equals(Object o) { 1267 return o instanceof org.netbeans.modules.schema2beansdev.metadd.MetaElement && equals((org.netbeans.modules.schema2beansdev.metadd.MetaElement) o); 1268 } 1269 1270 public boolean equals(org.netbeans.modules.schema2beansdev.metadd.MetaElement inst) { 1271 if (inst == this) { 1272 return true; 1273 } 1274 if (inst == null) { 1275 return false; 1276 } 1277 if (!(_DtdName == null ? inst._DtdName == null : _DtdName.equals(inst._DtdName))) { 1278 return false; 1279 } 1280 if (!(_Namespace == null ? inst._Namespace == null : _Namespace.equals(inst._Namespace))) { 1281 return false; 1282 } 1283 if (!(_BeanName == null ? inst._BeanName == null : _BeanName.equals(inst._BeanName))) { 1284 return false; 1285 } 1286 if (!(_BeanClass == null ? inst._BeanClass == null : _BeanClass.equals(inst._BeanClass))) { 1287 return false; 1288 } 1289 if (!(_WrapperClass == null ? inst._WrapperClass == null : _WrapperClass.equals(inst._WrapperClass))) { 1290 return false; 1291 } 1292 if (sizeDefaultValue() != inst.sizeDefaultValue()) 1293 return false; 1294 for (java.util.Iterator it = _DefaultValue.iterator(), it2 = inst._DefaultValue.iterator(); 1296 it.hasNext() && it2.hasNext(); ) { 1297 String element = (String )it.next(); 1298 String element2 = (String )it2.next(); 1299 if (!(element == null ? element2 == null : element.equals(element2))) { 1300 return false; 1301 } 1302 } 1303 if (sizeKnownValue() != inst.sizeKnownValue()) 1304 return false; 1305 for (java.util.Iterator it = _KnownValue.iterator(), it2 = inst._KnownValue.iterator(); 1307 it.hasNext() && it2.hasNext(); ) { 1308 String element = (String )it.next(); 1309 String element2 = (String )it2.next(); 1310 if (!(element == null ? element2 == null : element.equals(element2))) { 1311 return false; 1312 } 1313 } 1314 if (sizeMetaProperty() != inst.sizeMetaProperty()) 1315 return false; 1316 for (java.util.Iterator it = _MetaProperty.iterator(), it2 = inst._MetaProperty.iterator(); 1318 it.hasNext() && it2.hasNext(); ) { 1319 org.netbeans.modules.schema2beansdev.metadd.MetaProperty element = (org.netbeans.modules.schema2beansdev.metadd.MetaProperty)it.next(); 1320 org.netbeans.modules.schema2beansdev.metadd.MetaProperty element2 = (org.netbeans.modules.schema2beansdev.metadd.MetaProperty)it2.next(); 1321 if (!(element == null ? element2 == null : element.equals(element2))) { 1322 return false; 1323 } 1324 } 1325 if (sizeComparatorClass() != inst.sizeComparatorClass()) 1326 return false; 1327 for (java.util.Iterator it = _ComparatorClass.iterator(), it2 = inst._ComparatorClass.iterator(); 1329 it.hasNext() && it2.hasNext(); ) { 1330 String element = (String )it.next(); 1331 String element2 = (String )it2.next(); 1332 if (!(element == null ? element2 == null : element.equals(element2))) { 1333 return false; 1334 } 1335 } 1336 if (!(_Implements == null ? inst._Implements == null : _Implements.equals(inst._Implements))) { 1337 return false; 1338 } 1339 if (!(_Extends == null ? inst._Extends == null : _Extends.equals(inst._Extends))) { 1340 return false; 1341 } 1342 if (sizeImport() != inst.sizeImport()) 1343 return false; 1344 for (java.util.Iterator it = _Import.iterator(), it2 = inst._Import.iterator(); 1346 it.hasNext() && it2.hasNext(); ) { 1347 String element = (String )it.next(); 1348 String element2 = (String )it2.next(); 1349 if (!(element == null ? element2 == null : element.equals(element2))) { 1350 return false; 1351 } 1352 } 1353 if (!(_UserCode == null ? inst._UserCode == null : _UserCode.equals(inst._UserCode))) { 1354 return false; 1355 } 1356 if (_isSet_Vetoable != inst._isSet_Vetoable) { 1357 return false; 1358 } 1359 if (_isSet_Vetoable) { 1360 if (!(_Vetoable == inst._Vetoable)) { 1361 return false; 1362 } 1363 } 1364 if (_isSet_SkipGeneration != inst._isSet_SkipGeneration) { 1365 return false; 1366 } 1367 if (_isSet_SkipGeneration) { 1368 if (!(_SkipGeneration == inst._SkipGeneration)) { 1369 return false; 1370 } 1371 } 1372 if (!(_DelegatorName == null ? inst._DelegatorName == null : _DelegatorName.equals(inst._DelegatorName))) { 1373 return false; 1374 } 1375 if (!(_DelegatorExtends == null ? inst._DelegatorExtends == null : _DelegatorExtends.equals(inst._DelegatorExtends))) { 1376 return false; 1377 } 1378 if (!(_BeanInterfaceExtends == null ? inst._BeanInterfaceExtends == null : _BeanInterfaceExtends.equals(inst._BeanInterfaceExtends))) { 1379 return false; 1380 } 1381 if (_isSet_CanBeEmpty != inst._isSet_CanBeEmpty) { 1382 return false; 1383 } 1384 if (_isSet_CanBeEmpty) { 1385 if (!(_CanBeEmpty == inst._CanBeEmpty)) { 1386 return false; 1387 } 1388 } 1389 return true; 1390 } 1391 1392 public int hashCode() { 1393 int result = 17; 1394 result = 37*result + (_DtdName == null ? 0 : _DtdName.hashCode()); 1395 result = 37*result + (_Namespace == null ? 0 : _Namespace.hashCode()); 1396 result = 37*result + (_BeanName == null ? 0 : _BeanName.hashCode()); 1397 result = 37*result + (_BeanClass == null ? 0 : _BeanClass.hashCode()); 1398 result = 37*result + (_WrapperClass == null ? 0 : _WrapperClass.hashCode()); 1399 result = 37*result + (_DefaultValue == null ? 0 : _DefaultValue.hashCode()); 1400 result = 37*result + (_KnownValue == null ? 0 : _KnownValue.hashCode()); 1401 result = 37*result + (_MetaProperty == null ? 0 : _MetaProperty.hashCode()); 1402 result = 37*result + (_ComparatorClass == null ? 0 : _ComparatorClass.hashCode()); 1403 result = 37*result + (_Implements == null ? 0 : _Implements.hashCode()); 1404 result = 37*result + (_Extends == null ? 0 : _Extends.hashCode()); 1405 result = 37*result + (_Import == null ? 0 : _Import.hashCode()); 1406 result = 37*result + (_UserCode == null ? 0 : _UserCode.hashCode()); 1407 result = 37*result + (_isSet_Vetoable ? 0 : (_Vetoable ? 0 : 1)); 1408 result = 37*result + (_isSet_SkipGeneration ? 0 : (_SkipGeneration ? 0 : 1)); 1409 result = 37*result + (_DelegatorName == null ? 0 : _DelegatorName.hashCode()); 1410 result = 37*result + (_DelegatorExtends == null ? 0 : _DelegatorExtends.hashCode()); 1411 result = 37*result + (_BeanInterfaceExtends == null ? 0 : _BeanInterfaceExtends.hashCode()); 1412 result = 37*result + (_isSet_CanBeEmpty ? 0 : (_CanBeEmpty ? 0 : 1)); 1413 return result; 1414 } 1415 1416 public String toString() { 1417 java.io.StringWriter sw = new java.io.StringWriter (); 1418 try { 1419 writeNode(sw); 1420 } catch (java.io.IOException e) { 1421 throw new RuntimeException (e); 1423 } 1424 return sw.toString(); 1425 } 1426 1427} 1428 1429 1430 1520 | Popular Tags |