0001: /*
0002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003: *
0004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005: *
0006: * The contents of this file are subject to the terms of either the GNU
0007: * General Public License Version 2 only ("GPL") or the Common
0008: * Development and Distribution License("CDDL") (collectively, the
0009: * "License"). You may not use this file except in compliance with the
0010: * License. You can obtain a copy of the License at
0011: * http://www.netbeans.org/cddl-gplv2.html
0012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
0013: * specific language governing permissions and limitations under the
0014: * License. When distributing the software, include this License Header
0015: * Notice in each file and include the License file at
0016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
0017: * particular file as subject to the "Classpath" exception as provided
0018: * by Sun in the GPL Version 2 section of the License file that
0019: * accompanied this code. If applicable, add the following below the
0020: * License Header, with the fields enclosed by brackets [] replaced by
0021: * your own identifying information:
0022: * "Portions Copyrighted [year] [name of copyright owner]"
0023: *
0024: * Contributor(s):
0025: *
0026: * The Original Software is NetBeans. The Initial Developer of the Original
0027: * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
0028: * Microsystems, Inc. All Rights Reserved.
0029: *
0030: * If you wish your version of this file to be governed by only the CDDL
0031: * or only the GPL Version 2, indicate your decision by adding
0032: * "[Contributor] elects to include this software in this distribution
0033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
0034: * single choice of license, a recipient has the option to distribute
0035: * your version of this file under either the CDDL, the GPL Version 2 or
0036: * to extend the choice of license to its licensees as provided above.
0037: * However, if you add GPL Version 2 code and therefore, elected the GPL
0038: * Version 2 license, then the option applies only if the new code is
0039: * made subject to such option by the copyright holder.
0040: */
0041: /**
0042: * This generated bean class MetaElement
0043: * matches the schema element 'meta-element'.
0044: * The root bean class is MetaDD
0045: *
0046: * @Generated
0047: */package org.netbeans.modules.schema2beansdev.metadd;
0048:
0049: public class MetaElement implements
0050: org.netbeans.modules.schema2beansdev.metadd.CommonBean {
0051: public static final String DTD_NAME = "DtdName"; // NOI18N
0052: public static final String NAMESPACE = "Namespace"; // NOI18N
0053: public static final String BEAN_NAME = "BeanName"; // NOI18N
0054: public static final String BEAN_CLASS = "BeanClass"; // NOI18N
0055: public static final String WRAPPER_CLASS = "WrapperClass"; // NOI18N
0056: public static final String DEFAULT_VALUE = "DefaultValue"; // NOI18N
0057: public static final String KNOWN_VALUE = "KnownValue"; // NOI18N
0058: public static final String META_PROPERTY = "MetaProperty"; // NOI18N
0059: public static final String COMPARATOR_CLASS = "ComparatorClass"; // NOI18N
0060: public static final String IMPLEMENTS = "Implements"; // NOI18N
0061: public static final String EXTENDS = "Extends"; // NOI18N
0062: public static final String IMPORT = "Import"; // NOI18N
0063: public static final String USER_CODE = "UserCode"; // NOI18N
0064: public static final String VETOABLE = "Vetoable"; // NOI18N
0065: public static final String SKIP_GENERATION = "SkipGeneration"; // NOI18N
0066: public static final String DELEGATOR_NAME = "DelegatorName"; // NOI18N
0067: public static final String DELEGATOR_EXTENDS = "DelegatorExtends"; // NOI18N
0068: public static final String BEAN_INTERFACE_EXTENDS = "BeanInterfaceExtends"; // NOI18N
0069: public static final String CAN_BE_EMPTY = "CanBeEmpty"; // NOI18N
0070:
0071: private String _DtdName;
0072: private String _Namespace;
0073: private String _BeanName;
0074: private String _BeanClass;
0075: private String _WrapperClass;
0076: private java.util.List _DefaultValue = new java.util.ArrayList(); // List<String>
0077: private java.util.List _KnownValue = new java.util.ArrayList(); // List<String>
0078: private java.util.List _MetaProperty = new java.util.ArrayList(); // List<MetaProperty>
0079: private java.util.List _ComparatorClass = new java.util.ArrayList(); // List<String>
0080: private String _Implements;
0081: private String _Extends;
0082: private java.util.List _Import = new java.util.ArrayList(); // List<String>
0083: private String _UserCode;
0084: private boolean _Vetoable;
0085: private boolean _isSet_Vetoable = false;
0086: private boolean _SkipGeneration;
0087: private boolean _isSet_SkipGeneration = false;
0088: private String _DelegatorName;
0089: private String _DelegatorExtends;
0090: private String _BeanInterfaceExtends;
0091: private boolean _CanBeEmpty;
0092: private boolean _isSet_CanBeEmpty = false;
0093:
0094: /**
0095: * Normal starting point constructor.
0096: */
0097: public MetaElement() {
0098: _DtdName = "";
0099: }
0100:
0101: /**
0102: * Required parameters constructor
0103: */
0104: public MetaElement(String dtdName) {
0105: _DtdName = dtdName;
0106: }
0107:
0108: /**
0109: * Deep copy
0110: */
0111: public MetaElement(
0112: org.netbeans.modules.schema2beansdev.metadd.MetaElement source) {
0113: this (source, false);
0114: }
0115:
0116: /**
0117: * Deep copy
0118: * @param justData just copy the XML relevant data
0119: */
0120: public MetaElement(
0121: org.netbeans.modules.schema2beansdev.metadd.MetaElement source,
0122: boolean justData) {
0123: _DtdName = source._DtdName;
0124: _Namespace = source._Namespace;
0125: _BeanName = source._BeanName;
0126: _BeanClass = source._BeanClass;
0127: _WrapperClass = source._WrapperClass;
0128: for (java.util.Iterator it = source._DefaultValue.iterator(); it
0129: .hasNext();) {
0130: String srcElement = (String) it.next();
0131: _DefaultValue.add(srcElement);
0132: }
0133: for (java.util.Iterator it = source._KnownValue.iterator(); it
0134: .hasNext();) {
0135: String srcElement = (String) it.next();
0136: _KnownValue.add(srcElement);
0137: }
0138: for (java.util.Iterator it = source._MetaProperty.iterator(); it
0139: .hasNext();) {
0140: org.netbeans.modules.schema2beansdev.metadd.MetaProperty srcElement = (org.netbeans.modules.schema2beansdev.metadd.MetaProperty) it
0141: .next();
0142: _MetaProperty.add((srcElement == null) ? null
0143: : newMetaProperty(srcElement, justData));
0144: }
0145: for (java.util.Iterator it = source._ComparatorClass.iterator(); it
0146: .hasNext();) {
0147: String srcElement = (String) it.next();
0148: _ComparatorClass.add(srcElement);
0149: }
0150: _Implements = source._Implements;
0151: _Extends = source._Extends;
0152: for (java.util.Iterator it = source._Import.iterator(); it
0153: .hasNext();) {
0154: String srcElement = (String) it.next();
0155: _Import.add(srcElement);
0156: }
0157: _UserCode = source._UserCode;
0158: _Vetoable = source._Vetoable;
0159: _isSet_Vetoable = source._isSet_Vetoable;
0160: _SkipGeneration = source._SkipGeneration;
0161: _isSet_SkipGeneration = source._isSet_SkipGeneration;
0162: _DelegatorName = source._DelegatorName;
0163: _DelegatorExtends = source._DelegatorExtends;
0164: _BeanInterfaceExtends = source._BeanInterfaceExtends;
0165: _CanBeEmpty = source._CanBeEmpty;
0166: _isSet_CanBeEmpty = source._isSet_CanBeEmpty;
0167: }
0168:
0169: // This attribute is mandatory
0170: public void setDtdName(String value) {
0171: _DtdName = value;
0172: }
0173:
0174: public String getDtdName() {
0175: return _DtdName;
0176: }
0177:
0178: // This attribute is optional
0179: public void setNamespace(String value) {
0180: _Namespace = value;
0181: }
0182:
0183: public String getNamespace() {
0184: return _Namespace;
0185: }
0186:
0187: // This attribute is optional
0188: public void setBeanName(String value) {
0189: _BeanName = value;
0190: }
0191:
0192: public String getBeanName() {
0193: return _BeanName;
0194: }
0195:
0196: // This attribute is optional
0197: public void setBeanClass(String value) {
0198: _BeanClass = value;
0199: }
0200:
0201: public String getBeanClass() {
0202: return _BeanClass;
0203: }
0204:
0205: // This attribute is optional
0206: public void setWrapperClass(String value) {
0207: _WrapperClass = value;
0208: }
0209:
0210: public String getWrapperClass() {
0211: return _WrapperClass;
0212: }
0213:
0214: // This attribute is an array, possibly empty
0215: public void setDefaultValue(String[] value) {
0216: if (value == null)
0217: value = new String[0];
0218: _DefaultValue.clear();
0219: ((java.util.ArrayList) _DefaultValue)
0220: .ensureCapacity(value.length);
0221: for (int i = 0; i < value.length; ++i) {
0222: _DefaultValue.add(value[i]);
0223: }
0224: }
0225:
0226: public void setDefaultValue(int index, String value) {
0227: _DefaultValue.set(index, value);
0228: }
0229:
0230: public String[] getDefaultValue() {
0231: String[] arr = new String[_DefaultValue.size()];
0232: return (String[]) _DefaultValue.toArray(arr);
0233: }
0234:
0235: public java.util.List fetchDefaultValueList() {
0236: return _DefaultValue;
0237: }
0238:
0239: public String getDefaultValue(int index) {
0240: return (String) _DefaultValue.get(index);
0241: }
0242:
0243: // Return the number of defaultValue
0244: public int sizeDefaultValue() {
0245: return _DefaultValue.size();
0246: }
0247:
0248: public int addDefaultValue(String value) {
0249: _DefaultValue.add(value);
0250: int positionOfNewItem = _DefaultValue.size() - 1;
0251: return positionOfNewItem;
0252: }
0253:
0254: /**
0255: * Search from the end looking for @param value, and then remove it.
0256: */
0257: public int removeDefaultValue(String value) {
0258: int pos = _DefaultValue.indexOf(value);
0259: if (pos >= 0) {
0260: _DefaultValue.remove(pos);
0261: }
0262: return pos;
0263: }
0264:
0265: // This attribute is an array, possibly empty
0266: public void setKnownValue(String[] value) {
0267: if (value == null)
0268: value = new String[0];
0269: _KnownValue.clear();
0270: ((java.util.ArrayList) _KnownValue)
0271: .ensureCapacity(value.length);
0272: for (int i = 0; i < value.length; ++i) {
0273: _KnownValue.add(value[i]);
0274: }
0275: }
0276:
0277: public void setKnownValue(int index, String value) {
0278: _KnownValue.set(index, value);
0279: }
0280:
0281: public String[] getKnownValue() {
0282: String[] arr = new String[_KnownValue.size()];
0283: return (String[]) _KnownValue.toArray(arr);
0284: }
0285:
0286: public java.util.List fetchKnownValueList() {
0287: return _KnownValue;
0288: }
0289:
0290: public String getKnownValue(int index) {
0291: return (String) _KnownValue.get(index);
0292: }
0293:
0294: // Return the number of knownValue
0295: public int sizeKnownValue() {
0296: return _KnownValue.size();
0297: }
0298:
0299: public int addKnownValue(String value) {
0300: _KnownValue.add(value);
0301: int positionOfNewItem = _KnownValue.size() - 1;
0302: return positionOfNewItem;
0303: }
0304:
0305: /**
0306: * Search from the end looking for @param value, and then remove it.
0307: */
0308: public int removeKnownValue(String value) {
0309: int pos = _KnownValue.indexOf(value);
0310: if (pos >= 0) {
0311: _KnownValue.remove(pos);
0312: }
0313: return pos;
0314: }
0315:
0316: // This attribute is an array, possibly empty
0317: public void setMetaProperty(
0318: org.netbeans.modules.schema2beansdev.metadd.MetaProperty[] value) {
0319: if (value == null)
0320: value = new MetaProperty[0];
0321: _MetaProperty.clear();
0322: ((java.util.ArrayList) _MetaProperty)
0323: .ensureCapacity(value.length);
0324: for (int i = 0; i < value.length; ++i) {
0325: _MetaProperty.add(value[i]);
0326: }
0327: }
0328:
0329: public void setMetaProperty(
0330: int index,
0331: org.netbeans.modules.schema2beansdev.metadd.MetaProperty value) {
0332: _MetaProperty.set(index, value);
0333: }
0334:
0335: public org.netbeans.modules.schema2beansdev.metadd.MetaProperty[] getMetaProperty() {
0336: MetaProperty[] arr = new MetaProperty[_MetaProperty.size()];
0337: return (MetaProperty[]) _MetaProperty.toArray(arr);
0338: }
0339:
0340: public java.util.List fetchMetaPropertyList() {
0341: return _MetaProperty;
0342: }
0343:
0344: public org.netbeans.modules.schema2beansdev.metadd.MetaProperty getMetaProperty(
0345: int index) {
0346: return (MetaProperty) _MetaProperty.get(index);
0347: }
0348:
0349: // Return the number of metaProperty
0350: public int sizeMetaProperty() {
0351: return _MetaProperty.size();
0352: }
0353:
0354: public int addMetaProperty(
0355: org.netbeans.modules.schema2beansdev.metadd.MetaProperty value) {
0356: _MetaProperty.add(value);
0357: int positionOfNewItem = _MetaProperty.size() - 1;
0358: return positionOfNewItem;
0359: }
0360:
0361: /**
0362: * Search from the end looking for @param value, and then remove it.
0363: */
0364: public int removeMetaProperty(
0365: org.netbeans.modules.schema2beansdev.metadd.MetaProperty value) {
0366: int pos = _MetaProperty.indexOf(value);
0367: if (pos >= 0) {
0368: _MetaProperty.remove(pos);
0369: }
0370: return pos;
0371: }
0372:
0373: // This attribute is an array, possibly empty
0374: public void setComparatorClass(String[] value) {
0375: if (value == null)
0376: value = new String[0];
0377: _ComparatorClass.clear();
0378: ((java.util.ArrayList) _ComparatorClass)
0379: .ensureCapacity(value.length);
0380: for (int i = 0; i < value.length; ++i) {
0381: _ComparatorClass.add(value[i]);
0382: }
0383: }
0384:
0385: public void setComparatorClass(int index, String value) {
0386: _ComparatorClass.set(index, value);
0387: }
0388:
0389: public String[] getComparatorClass() {
0390: String[] arr = new String[_ComparatorClass.size()];
0391: return (String[]) _ComparatorClass.toArray(arr);
0392: }
0393:
0394: public java.util.List fetchComparatorClassList() {
0395: return _ComparatorClass;
0396: }
0397:
0398: public String getComparatorClass(int index) {
0399: return (String) _ComparatorClass.get(index);
0400: }
0401:
0402: // Return the number of comparatorClass
0403: public int sizeComparatorClass() {
0404: return _ComparatorClass.size();
0405: }
0406:
0407: public int addComparatorClass(String value) {
0408: _ComparatorClass.add(value);
0409: int positionOfNewItem = _ComparatorClass.size() - 1;
0410: return positionOfNewItem;
0411: }
0412:
0413: /**
0414: * Search from the end looking for @param value, and then remove it.
0415: */
0416: public int removeComparatorClass(String value) {
0417: int pos = _ComparatorClass.indexOf(value);
0418: if (pos >= 0) {
0419: _ComparatorClass.remove(pos);
0420: }
0421: return pos;
0422: }
0423:
0424: // This attribute is optional
0425: public void setImplements(String value) {
0426: _Implements = value;
0427: }
0428:
0429: public String getImplements() {
0430: return _Implements;
0431: }
0432:
0433: // This attribute is optional
0434: public void setExtends(String value) {
0435: _Extends = value;
0436: }
0437:
0438: public String getExtends() {
0439: return _Extends;
0440: }
0441:
0442: // This attribute is an array, possibly empty
0443: public void setImport(String[] value) {
0444: if (value == null)
0445: value = new String[0];
0446: _Import.clear();
0447: ((java.util.ArrayList) _Import).ensureCapacity(value.length);
0448: for (int i = 0; i < value.length; ++i) {
0449: _Import.add(value[i]);
0450: }
0451: }
0452:
0453: public void setImport(int index, String value) {
0454: _Import.set(index, value);
0455: }
0456:
0457: public String[] getImport() {
0458: String[] arr = new String[_Import.size()];
0459: return (String[]) _Import.toArray(arr);
0460: }
0461:
0462: public java.util.List fetchImportList() {
0463: return _Import;
0464: }
0465:
0466: public String getImport(int index) {
0467: return (String) _Import.get(index);
0468: }
0469:
0470: // Return the number of import
0471: public int sizeImport() {
0472: return _Import.size();
0473: }
0474:
0475: public int addImport(String value) {
0476: _Import.add(value);
0477: int positionOfNewItem = _Import.size() - 1;
0478: return positionOfNewItem;
0479: }
0480:
0481: /**
0482: * Search from the end looking for @param value, and then remove it.
0483: */
0484: public int removeImport(String value) {
0485: int pos = _Import.indexOf(value);
0486: if (pos >= 0) {
0487: _Import.remove(pos);
0488: }
0489: return pos;
0490: }
0491:
0492: // This attribute is optional
0493: public void setUserCode(String value) {
0494: _UserCode = value;
0495: }
0496:
0497: public String getUserCode() {
0498: return _UserCode;
0499: }
0500:
0501: // This attribute is optional
0502: public void setVetoable(boolean value) {
0503: _Vetoable = value;
0504: _isSet_Vetoable = true;
0505: }
0506:
0507: public boolean isVetoable() {
0508: return _Vetoable;
0509: }
0510:
0511: // This attribute is optional
0512: public void setSkipGeneration(boolean value) {
0513: _SkipGeneration = value;
0514: _isSet_SkipGeneration = true;
0515: }
0516:
0517: public boolean isSkipGeneration() {
0518: return _SkipGeneration;
0519: }
0520:
0521: // This attribute is optional
0522: public void setDelegatorName(String value) {
0523: _DelegatorName = value;
0524: }
0525:
0526: public String getDelegatorName() {
0527: return _DelegatorName;
0528: }
0529:
0530: // This attribute is optional
0531: public void setDelegatorExtends(String value) {
0532: _DelegatorExtends = value;
0533: }
0534:
0535: public String getDelegatorExtends() {
0536: return _DelegatorExtends;
0537: }
0538:
0539: // This attribute is optional
0540: public void setBeanInterfaceExtends(String value) {
0541: _BeanInterfaceExtends = value;
0542: }
0543:
0544: public String getBeanInterfaceExtends() {
0545: return _BeanInterfaceExtends;
0546: }
0547:
0548: // This attribute is optional
0549: public void setCanBeEmpty(boolean value) {
0550: _CanBeEmpty = value;
0551: _isSet_CanBeEmpty = true;
0552: }
0553:
0554: public boolean isCanBeEmpty() {
0555: return _CanBeEmpty;
0556: }
0557:
0558: /**
0559: * Create a new bean using it's default constructor.
0560: * This does not add it to any bean graph.
0561: */
0562: public org.netbeans.modules.schema2beansdev.metadd.MetaProperty newMetaProperty() {
0563: return new org.netbeans.modules.schema2beansdev.metadd.MetaProperty();
0564: }
0565:
0566: /**
0567: * Create a new bean, copying from another one.
0568: * This does not add it to any bean graph.
0569: */
0570: public org.netbeans.modules.schema2beansdev.metadd.MetaProperty newMetaProperty(
0571: MetaProperty source, boolean justData) {
0572: return new org.netbeans.modules.schema2beansdev.metadd.MetaProperty(
0573: source, justData);
0574: }
0575:
0576: public void writeNode(java.io.Writer out)
0577: throws java.io.IOException {
0578: String myName;
0579: myName = "meta-element";
0580: writeNode(out, myName, ""); // NOI18N
0581: }
0582:
0583: public void writeNode(java.io.Writer out, String nodeName,
0584: String indent) throws java.io.IOException {
0585: writeNode(out, nodeName, null, indent, new java.util.HashMap());
0586: }
0587:
0588: /**
0589: * It's not recommended to call this method directly.
0590: */
0591: public void writeNode(java.io.Writer out, String nodeName,
0592: String namespace, String indent, java.util.Map namespaceMap)
0593: throws java.io.IOException {
0594: out.write(indent);
0595: out.write("<");
0596: if (namespace != null) {
0597: out.write((String) namespaceMap.get(namespace));
0598: out.write(":");
0599: }
0600: out.write(nodeName);
0601: out.write(">\n");
0602: String nextIndent = indent + " ";
0603: if (_DtdName != null) {
0604: out.write(nextIndent);
0605: out.write("<dtd-name"); // NOI18N
0606: out.write(">"); // NOI18N
0607: org.netbeans.modules.schema2beansdev.metadd.MetaDD
0608: .writeXML(out, _DtdName, false);
0609: out.write("</dtd-name>\n"); // NOI18N
0610: }
0611: if (_Namespace != null) {
0612: out.write(nextIndent);
0613: out.write("<namespace"); // NOI18N
0614: out.write(">"); // NOI18N
0615: org.netbeans.modules.schema2beansdev.metadd.MetaDD
0616: .writeXML(out, _Namespace, false);
0617: out.write("</namespace>\n"); // NOI18N
0618: }
0619: if (_BeanName != null) {
0620: out.write(nextIndent);
0621: out.write("<bean-name"); // NOI18N
0622: out.write(">"); // NOI18N
0623: org.netbeans.modules.schema2beansdev.metadd.MetaDD
0624: .writeXML(out, _BeanName, false);
0625: out.write("</bean-name>\n"); // NOI18N
0626: }
0627: if (_BeanClass != null) {
0628: out.write(nextIndent);
0629: out.write("<bean-class"); // NOI18N
0630: out.write(">"); // NOI18N
0631: org.netbeans.modules.schema2beansdev.metadd.MetaDD
0632: .writeXML(out, _BeanClass, false);
0633: out.write("</bean-class>\n"); // NOI18N
0634: }
0635: if (_WrapperClass != null) {
0636: out.write(nextIndent);
0637: out.write("<wrapper-class"); // NOI18N
0638: out.write(">"); // NOI18N
0639: org.netbeans.modules.schema2beansdev.metadd.MetaDD
0640: .writeXML(out, _WrapperClass, false);
0641: out.write("</wrapper-class>\n"); // NOI18N
0642: }
0643: for (java.util.Iterator it = _DefaultValue.iterator(); it
0644: .hasNext();) {
0645: String element = (String) it.next();
0646: if (element != null) {
0647: out.write(nextIndent);
0648: out.write("<default-value"); // NOI18N
0649: out.write(">"); // NOI18N
0650: org.netbeans.modules.schema2beansdev.metadd.MetaDD
0651: .writeXML(out, element, false);
0652: out.write("</default-value>\n"); // NOI18N
0653: }
0654: }
0655: for (java.util.Iterator it = _KnownValue.iterator(); it
0656: .hasNext();) {
0657: String element = (String) it.next();
0658: if (element != null) {
0659: out.write(nextIndent);
0660: out.write("<known-value"); // NOI18N
0661: out.write(">"); // NOI18N
0662: org.netbeans.modules.schema2beansdev.metadd.MetaDD
0663: .writeXML(out, element, false);
0664: out.write("</known-value>\n"); // NOI18N
0665: }
0666: }
0667: for (java.util.Iterator it = _MetaProperty.iterator(); it
0668: .hasNext();) {
0669: org.netbeans.modules.schema2beansdev.metadd.MetaProperty element = (org.netbeans.modules.schema2beansdev.metadd.MetaProperty) it
0670: .next();
0671: if (element != null) {
0672: element.writeNode(out, "meta-property", null,
0673: nextIndent, namespaceMap);
0674: }
0675: }
0676: for (java.util.Iterator it = _ComparatorClass.iterator(); it
0677: .hasNext();) {
0678: String element = (String) it.next();
0679: if (element != null) {
0680: out.write(nextIndent);
0681: out.write("<comparator-class"); // NOI18N
0682: out.write(">"); // NOI18N
0683: org.netbeans.modules.schema2beansdev.metadd.MetaDD
0684: .writeXML(out, element, false);
0685: out.write("</comparator-class>\n"); // NOI18N
0686: }
0687: }
0688: if (_Implements != null) {
0689: out.write(nextIndent);
0690: out.write("<implements"); // NOI18N
0691: out.write(">"); // NOI18N
0692: org.netbeans.modules.schema2beansdev.metadd.MetaDD
0693: .writeXML(out, _Implements, false);
0694: out.write("</implements>\n"); // NOI18N
0695: }
0696: if (_Extends != null) {
0697: out.write(nextIndent);
0698: out.write("<extends"); // NOI18N
0699: out.write(">"); // NOI18N
0700: org.netbeans.modules.schema2beansdev.metadd.MetaDD
0701: .writeXML(out, _Extends, false);
0702: out.write("</extends>\n"); // NOI18N
0703: }
0704: for (java.util.Iterator it = _Import.iterator(); it.hasNext();) {
0705: String element = (String) it.next();
0706: if (element != null) {
0707: out.write(nextIndent);
0708: out.write("<import"); // NOI18N
0709: out.write(">"); // NOI18N
0710: org.netbeans.modules.schema2beansdev.metadd.MetaDD
0711: .writeXML(out, element, false);
0712: out.write("</import>\n"); // NOI18N
0713: }
0714: }
0715: if (_UserCode != null) {
0716: out.write(nextIndent);
0717: out.write("<user-code"); // NOI18N
0718: out.write(">"); // NOI18N
0719: org.netbeans.modules.schema2beansdev.metadd.MetaDD
0720: .writeXML(out, _UserCode, false);
0721: out.write("</user-code>\n"); // NOI18N
0722: }
0723: if (_isSet_Vetoable) {
0724: if (_Vetoable) {
0725: out.write(nextIndent);
0726: out.write("<vetoable"); // NOI18N
0727: out.write("/>\n"); // NOI18N
0728: }
0729: }
0730: if (_isSet_SkipGeneration) {
0731: if (_SkipGeneration) {
0732: out.write(nextIndent);
0733: out.write("<skip-generation"); // NOI18N
0734: out.write("/>\n"); // NOI18N
0735: }
0736: }
0737: if (_DelegatorName != null) {
0738: out.write(nextIndent);
0739: out.write("<delegator-name"); // NOI18N
0740: out.write(">"); // NOI18N
0741: org.netbeans.modules.schema2beansdev.metadd.MetaDD
0742: .writeXML(out, _DelegatorName, false);
0743: out.write("</delegator-name>\n"); // NOI18N
0744: }
0745: if (_DelegatorExtends != null) {
0746: out.write(nextIndent);
0747: out.write("<delegator-extends"); // NOI18N
0748: out.write(">"); // NOI18N
0749: org.netbeans.modules.schema2beansdev.metadd.MetaDD
0750: .writeXML(out, _DelegatorExtends, false);
0751: out.write("</delegator-extends>\n"); // NOI18N
0752: }
0753: if (_BeanInterfaceExtends != null) {
0754: out.write(nextIndent);
0755: out.write("<bean-interface-extends"); // NOI18N
0756: out.write(">"); // NOI18N
0757: org.netbeans.modules.schema2beansdev.metadd.MetaDD
0758: .writeXML(out, _BeanInterfaceExtends, false);
0759: out.write("</bean-interface-extends>\n"); // NOI18N
0760: }
0761: if (_isSet_CanBeEmpty) {
0762: if (_CanBeEmpty) {
0763: out.write(nextIndent);
0764: out.write("<can-be-empty"); // NOI18N
0765: out.write("/>\n"); // NOI18N
0766: }
0767: }
0768: out.write(indent);
0769: out.write("</");
0770: if (namespace != null) {
0771: out.write((String) namespaceMap.get(namespace));
0772: out.write(":");
0773: }
0774: out.write(nodeName);
0775: out.write(">\n");
0776: }
0777:
0778: public void readNode(org.w3c.dom.Node node) {
0779: readNode(node, new java.util.HashMap());
0780: }
0781:
0782: public void readNode(org.w3c.dom.Node node,
0783: java.util.Map namespacePrefixes) {
0784: if (node.hasAttributes()) {
0785: org.w3c.dom.NamedNodeMap attrs = node.getAttributes();
0786: org.w3c.dom.Attr attr;
0787: java.lang.String attrValue;
0788: boolean firstNamespaceDef = true;
0789: for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) {
0790: attr = (org.w3c.dom.Attr) attrs.item(attrNum);
0791: String attrName = attr.getName();
0792: if (attrName.startsWith("xmlns:")) {
0793: if (firstNamespaceDef) {
0794: firstNamespaceDef = false;
0795: // Dup prefix map, so as to not write over previous values, and to make it easy to clear out our entries.
0796: namespacePrefixes = new java.util.HashMap(
0797: namespacePrefixes);
0798: }
0799: String attrNSPrefix = attrName.substring(6,
0800: attrName.length());
0801: namespacePrefixes
0802: .put(attrNSPrefix, attr.getValue());
0803: }
0804: }
0805: }
0806: org.w3c.dom.NodeList children = node.getChildNodes();
0807: for (int i = 0, size = children.getLength(); i < size; ++i) {
0808: org.w3c.dom.Node childNode = children.item(i);
0809: String childNodeName = (childNode.getLocalName() == null ? childNode
0810: .getNodeName().intern()
0811: : childNode.getLocalName().intern());
0812: String childNodeValue = "";
0813: if (childNode.getFirstChild() != null) {
0814: childNodeValue = childNode.getFirstChild()
0815: .getNodeValue();
0816: }
0817: if (childNodeName == "dtd-name") {
0818: _DtdName = childNodeValue;
0819: } else if (childNodeName == "namespace") {
0820: _Namespace = childNodeValue;
0821: } else if (childNodeName == "bean-name") {
0822: _BeanName = childNodeValue;
0823: } else if (childNodeName == "bean-class") {
0824: _BeanClass = childNodeValue;
0825: } else if (childNodeName == "wrapper-class") {
0826: _WrapperClass = childNodeValue;
0827: } else if (childNodeName == "default-value") {
0828: String aDefaultValue;
0829: aDefaultValue = childNodeValue;
0830: _DefaultValue.add(aDefaultValue);
0831: } else if (childNodeName == "known-value") {
0832: String aKnownValue;
0833: aKnownValue = childNodeValue;
0834: _KnownValue.add(aKnownValue);
0835: } else if (childNodeName == "meta-property") {
0836: MetaProperty aMetaProperty = newMetaProperty();
0837: aMetaProperty.readNode(childNode, namespacePrefixes);
0838: _MetaProperty.add(aMetaProperty);
0839: } else if (childNodeName == "comparator-class") {
0840: String aComparatorClass;
0841: aComparatorClass = childNodeValue;
0842: _ComparatorClass.add(aComparatorClass);
0843: } else if (childNodeName == "implements") {
0844: _Implements = childNodeValue;
0845: } else if (childNodeName == "extends") {
0846: _Extends = childNodeValue;
0847: } else if (childNodeName == "import") {
0848: String aImport;
0849: aImport = childNodeValue;
0850: _Import.add(aImport);
0851: } else if (childNodeName == "user-code") {
0852: _UserCode = childNodeValue;
0853: } else if (childNodeName == "vetoable") {
0854: if (childNode.getFirstChild() == null)
0855: _Vetoable = true;
0856: else
0857: _Vetoable = java.lang.Boolean.valueOf(
0858: childNodeValue).booleanValue();
0859: _isSet_Vetoable = true;
0860: } else if (childNodeName == "skip-generation") {
0861: if (childNode.getFirstChild() == null)
0862: _SkipGeneration = true;
0863: else
0864: _SkipGeneration = java.lang.Boolean.valueOf(
0865: childNodeValue).booleanValue();
0866: _isSet_SkipGeneration = true;
0867: } else if (childNodeName == "delegator-name") {
0868: _DelegatorName = childNodeValue;
0869: } else if (childNodeName == "delegator-extends") {
0870: _DelegatorExtends = childNodeValue;
0871: } else if (childNodeName == "bean-interface-extends") {
0872: _BeanInterfaceExtends = childNodeValue;
0873: } else if (childNodeName == "can-be-empty") {
0874: if (childNode.getFirstChild() == null)
0875: _CanBeEmpty = true;
0876: else
0877: _CanBeEmpty = java.lang.Boolean.valueOf(
0878: childNodeValue).booleanValue();
0879: _isSet_CanBeEmpty = true;
0880: } else {
0881: // Found extra unrecognized childNode
0882: }
0883: }
0884: }
0885:
0886: public void validate()
0887: throws org.netbeans.modules.schema2beansdev.metadd.MetaDD.ValidateException {
0888: boolean restrictionFailure = false;
0889: boolean restrictionPassed = false;
0890: // Validating property dtdName
0891: if (getDtdName() == null) {
0892: throw new org.netbeans.modules.schema2beansdev.metadd.MetaDD.ValidateException(
0893: "getDtdName() == null",
0894: org.netbeans.modules.schema2beansdev.metadd.MetaDD.ValidateException.FailureType.NULL_VALUE,
0895: "dtdName", this ); // NOI18N
0896: }
0897: // Validating property namespace
0898: // Validating property beanName
0899: // Validating property beanClass
0900: // Validating property wrapperClass
0901: // Validating property defaultValue
0902: // Validating property knownValue
0903: // Validating property metaProperty
0904: for (int _index = 0; _index < sizeMetaProperty(); ++_index) {
0905: org.netbeans.modules.schema2beansdev.metadd.MetaProperty element = getMetaProperty(_index);
0906: if (element != null) {
0907: element.validate();
0908: }
0909: }
0910: // Validating property comparatorClass
0911: // Validating property implements
0912: // Validating property extends
0913: // Validating property import
0914: // Validating property userCode
0915: // Validating property vetoable
0916: // Validating property skipGeneration
0917: // Validating property delegatorName
0918: // Validating property delegatorExtends
0919: // Validating property beanInterfaceExtends
0920: // Validating property canBeEmpty
0921: }
0922:
0923: public void changePropertyByName(String name, Object value) {
0924: if (name == null)
0925: return;
0926: name = name.intern();
0927: if (name == "dtdName")
0928: setDtdName((String) value);
0929: else if (name == "namespace")
0930: setNamespace((String) value);
0931: else if (name == "beanName")
0932: setBeanName((String) value);
0933: else if (name == "beanClass")
0934: setBeanClass((String) value);
0935: else if (name == "wrapperClass")
0936: setWrapperClass((String) value);
0937: else if (name == "defaultValue")
0938: addDefaultValue((String) value);
0939: else if (name == "defaultValue[]")
0940: setDefaultValue((String[]) value);
0941: else if (name == "knownValue")
0942: addKnownValue((String) value);
0943: else if (name == "knownValue[]")
0944: setKnownValue((String[]) value);
0945: else if (name == "metaProperty")
0946: addMetaProperty((MetaProperty) value);
0947: else if (name == "metaProperty[]")
0948: setMetaProperty((MetaProperty[]) value);
0949: else if (name == "comparatorClass")
0950: addComparatorClass((String) value);
0951: else if (name == "comparatorClass[]")
0952: setComparatorClass((String[]) value);
0953: else if (name == "implements")
0954: setImplements((String) value);
0955: else if (name == "extends")
0956: setExtends((String) value);
0957: else if (name == "import")
0958: addImport((String) value);
0959: else if (name == "import[]")
0960: setImport((String[]) value);
0961: else if (name == "userCode")
0962: setUserCode((String) value);
0963: else if (name == "vetoable")
0964: setVetoable(((java.lang.Boolean) value).booleanValue());
0965: else if (name == "skipGeneration")
0966: setSkipGeneration(((java.lang.Boolean) value)
0967: .booleanValue());
0968: else if (name == "delegatorName")
0969: setDelegatorName((String) value);
0970: else if (name == "delegatorExtends")
0971: setDelegatorExtends((String) value);
0972: else if (name == "beanInterfaceExtends")
0973: setBeanInterfaceExtends((String) value);
0974: else if (name == "canBeEmpty")
0975: setCanBeEmpty(((java.lang.Boolean) value).booleanValue());
0976: else
0977: throw new IllegalArgumentException(name
0978: + " is not a valid property name for MetaElement");
0979: }
0980:
0981: public Object fetchPropertyByName(String name) {
0982: if (name == "dtdName")
0983: return getDtdName();
0984: if (name == "namespace")
0985: return getNamespace();
0986: if (name == "beanName")
0987: return getBeanName();
0988: if (name == "beanClass")
0989: return getBeanClass();
0990: if (name == "wrapperClass")
0991: return getWrapperClass();
0992: if (name == "defaultValue[]")
0993: return getDefaultValue();
0994: if (name == "knownValue[]")
0995: return getKnownValue();
0996: if (name == "metaProperty[]")
0997: return getMetaProperty();
0998: if (name == "comparatorClass[]")
0999: return getComparatorClass();
1000: if (name == "implements")
1001: return getImplements();
1002: if (name == "extends")
1003: return getExtends();
1004: if (name == "import[]")
1005: return getImport();
1006: if (name == "userCode")
1007: return getUserCode();
1008: if (name == "vetoable")
1009: return (isVetoable() ? java.lang.Boolean.TRUE
1010: : java.lang.Boolean.FALSE);
1011: if (name == "skipGeneration")
1012: return (isSkipGeneration() ? java.lang.Boolean.TRUE
1013: : java.lang.Boolean.FALSE);
1014: if (name == "delegatorName")
1015: return getDelegatorName();
1016: if (name == "delegatorExtends")
1017: return getDelegatorExtends();
1018: if (name == "beanInterfaceExtends")
1019: return getBeanInterfaceExtends();
1020: if (name == "canBeEmpty")
1021: return (isCanBeEmpty() ? java.lang.Boolean.TRUE
1022: : java.lang.Boolean.FALSE);
1023: throw new IllegalArgumentException(name
1024: + " is not a valid property name for MetaElement");
1025: }
1026:
1027: public String nameSelf() {
1028: return "MetaElement";
1029: }
1030:
1031: public String nameChild(Object childObj) {
1032: return nameChild(childObj, false, false);
1033: }
1034:
1035: /**
1036: * @param childObj The child object to search for
1037: * @param returnSchemaName Whether or not the schema name should be returned or the property name
1038: * @return null if not found
1039: */
1040: public String nameChild(Object childObj, boolean returnConstName,
1041: boolean returnSchemaName) {
1042: return nameChild(childObj, returnConstName, returnSchemaName,
1043: false);
1044: }
1045:
1046: /**
1047: * @param childObj The child object to search for
1048: * @param returnSchemaName Whether or not the schema name should be returned or the property name
1049: * @return null if not found
1050: */
1051: public String nameChild(Object childObj, boolean returnConstName,
1052: boolean returnSchemaName, boolean returnXPathName) {
1053: if (childObj instanceof java.lang.String) {
1054: java.lang.String child = (java.lang.String) childObj;
1055: if (child == _DtdName) {
1056: if (returnConstName) {
1057: return DTD_NAME;
1058: } else if (returnSchemaName) {
1059: return "dtd-name";
1060: } else if (returnXPathName) {
1061: return "dtd-name";
1062: } else {
1063: return "DtdName";
1064: }
1065: }
1066: if (child == _Namespace) {
1067: if (returnConstName) {
1068: return NAMESPACE;
1069: } else if (returnSchemaName) {
1070: return "namespace";
1071: } else if (returnXPathName) {
1072: return "namespace";
1073: } else {
1074: return "Namespace";
1075: }
1076: }
1077: if (child == _BeanName) {
1078: if (returnConstName) {
1079: return BEAN_NAME;
1080: } else if (returnSchemaName) {
1081: return "bean-name";
1082: } else if (returnXPathName) {
1083: return "bean-name";
1084: } else {
1085: return "BeanName";
1086: }
1087: }
1088: if (child == _BeanClass) {
1089: if (returnConstName) {
1090: return BEAN_CLASS;
1091: } else if (returnSchemaName) {
1092: return "bean-class";
1093: } else if (returnXPathName) {
1094: return "bean-class";
1095: } else {
1096: return "BeanClass";
1097: }
1098: }
1099: if (child == _WrapperClass) {
1100: if (returnConstName) {
1101: return WRAPPER_CLASS;
1102: } else if (returnSchemaName) {
1103: return "wrapper-class";
1104: } else if (returnXPathName) {
1105: return "wrapper-class";
1106: } else {
1107: return "WrapperClass";
1108: }
1109: }
1110: int index = 0;
1111: for (java.util.Iterator it = _DefaultValue.iterator(); it
1112: .hasNext();) {
1113: String element = (String) it.next();
1114: if (child == element) {
1115: if (returnConstName) {
1116: return DEFAULT_VALUE;
1117: } else if (returnSchemaName) {
1118: return "default-value";
1119: } else if (returnXPathName) {
1120: return "default-value[position()=" + index
1121: + "]";
1122: } else {
1123: return "DefaultValue."
1124: + Integer.toHexString(index);
1125: }
1126: }
1127: ++index;
1128: }
1129: index = 0;
1130: for (java.util.Iterator it = _KnownValue.iterator(); it
1131: .hasNext();) {
1132: String element = (String) it.next();
1133: if (child == element) {
1134: if (returnConstName) {
1135: return KNOWN_VALUE;
1136: } else if (returnSchemaName) {
1137: return "known-value";
1138: } else if (returnXPathName) {
1139: return "known-value[position()=" + index + "]";
1140: } else {
1141: return "KnownValue."
1142: + Integer.toHexString(index);
1143: }
1144: }
1145: ++index;
1146: }
1147: index = 0;
1148: for (java.util.Iterator it = _ComparatorClass.iterator(); it
1149: .hasNext();) {
1150: String element = (String) it.next();
1151: if (child == element) {
1152: if (returnConstName) {
1153: return COMPARATOR_CLASS;
1154: } else if (returnSchemaName) {
1155: return "comparator-class";
1156: } else if (returnXPathName) {
1157: return "comparator-class[position()=" + index
1158: + "]";
1159: } else {
1160: return "ComparatorClass."
1161: + Integer.toHexString(index);
1162: }
1163: }
1164: ++index;
1165: }
1166: if (child == _Implements) {
1167: if (returnConstName) {
1168: return IMPLEMENTS;
1169: } else if (returnSchemaName) {
1170: return "implements";
1171: } else if (returnXPathName) {
1172: return "implements";
1173: } else {
1174: return "Implements";
1175: }
1176: }
1177: if (child == _Extends) {
1178: if (returnConstName) {
1179: return EXTENDS;
1180: } else if (returnSchemaName) {
1181: return "extends";
1182: } else if (returnXPathName) {
1183: return "extends";
1184: } else {
1185: return "Extends";
1186: }
1187: }
1188: index = 0;
1189: for (java.util.Iterator it = _Import.iterator(); it
1190: .hasNext();) {
1191: String element = (String) it.next();
1192: if (child == element) {
1193: if (returnConstName) {
1194: return IMPORT;
1195: } else if (returnSchemaName) {
1196: return "import";
1197: } else if (returnXPathName) {
1198: return "import[position()=" + index + "]";
1199: } else {
1200: return "Import." + Integer.toHexString(index);
1201: }
1202: }
1203: ++index;
1204: }
1205: if (child == _UserCode) {
1206: if (returnConstName) {
1207: return USER_CODE;
1208: } else if (returnSchemaName) {
1209: return "user-code";
1210: } else if (returnXPathName) {
1211: return "user-code";
1212: } else {
1213: return "UserCode";
1214: }
1215: }
1216: if (child == _DelegatorName) {
1217: if (returnConstName) {
1218: return DELEGATOR_NAME;
1219: } else if (returnSchemaName) {
1220: return "delegator-name";
1221: } else if (returnXPathName) {
1222: return "delegator-name";
1223: } else {
1224: return "DelegatorName";
1225: }
1226: }
1227: if (child == _DelegatorExtends) {
1228: if (returnConstName) {
1229: return DELEGATOR_EXTENDS;
1230: } else if (returnSchemaName) {
1231: return "delegator-extends";
1232: } else if (returnXPathName) {
1233: return "delegator-extends";
1234: } else {
1235: return "DelegatorExtends";
1236: }
1237: }
1238: if (child == _BeanInterfaceExtends) {
1239: if (returnConstName) {
1240: return BEAN_INTERFACE_EXTENDS;
1241: } else if (returnSchemaName) {
1242: return "bean-interface-extends";
1243: } else if (returnXPathName) {
1244: return "bean-interface-extends";
1245: } else {
1246: return "BeanInterfaceExtends";
1247: }
1248: }
1249: }
1250: if (childObj instanceof MetaProperty) {
1251: MetaProperty child = (MetaProperty) childObj;
1252: int index = 0;
1253: for (java.util.Iterator it = _MetaProperty.iterator(); it
1254: .hasNext();) {
1255: org.netbeans.modules.schema2beansdev.metadd.MetaProperty element = (org.netbeans.modules.schema2beansdev.metadd.MetaProperty) it
1256: .next();
1257: if (child == element) {
1258: if (returnConstName) {
1259: return META_PROPERTY;
1260: } else if (returnSchemaName) {
1261: return "meta-property";
1262: } else if (returnXPathName) {
1263: return "meta-property[position()=" + index
1264: + "]";
1265: } else {
1266: return "MetaProperty."
1267: + Integer.toHexString(index);
1268: }
1269: }
1270: ++index;
1271: }
1272: }
1273: if (childObj instanceof java.lang.Boolean) {
1274: java.lang.Boolean child = (java.lang.Boolean) childObj;
1275: if (((java.lang.Boolean) child).booleanValue() == _Vetoable) {
1276: if (returnConstName) {
1277: return VETOABLE;
1278: } else if (returnSchemaName) {
1279: return "vetoable";
1280: } else if (returnXPathName) {
1281: return "vetoable";
1282: } else {
1283: return "Vetoable";
1284: }
1285: }
1286: if (((java.lang.Boolean) child).booleanValue() == _SkipGeneration) {
1287: if (returnConstName) {
1288: return SKIP_GENERATION;
1289: } else if (returnSchemaName) {
1290: return "skip-generation";
1291: } else if (returnXPathName) {
1292: return "skip-generation";
1293: } else {
1294: return "SkipGeneration";
1295: }
1296: }
1297: if (((java.lang.Boolean) child).booleanValue() == _CanBeEmpty) {
1298: if (returnConstName) {
1299: return CAN_BE_EMPTY;
1300: } else if (returnSchemaName) {
1301: return "can-be-empty";
1302: } else if (returnXPathName) {
1303: return "can-be-empty";
1304: } else {
1305: return "CanBeEmpty";
1306: }
1307: }
1308: }
1309: return null;
1310: }
1311:
1312: /**
1313: * Return an array of all of the properties that are beans and are set.
1314: */
1315: public org.netbeans.modules.schema2beansdev.metadd.CommonBean[] childBeans(
1316: boolean recursive) {
1317: java.util.List children = new java.util.LinkedList();
1318: childBeans(recursive, children);
1319: org.netbeans.modules.schema2beansdev.metadd.CommonBean[] result = new org.netbeans.modules.schema2beansdev.metadd.CommonBean[children
1320: .size()];
1321: return (org.netbeans.modules.schema2beansdev.metadd.CommonBean[]) children
1322: .toArray(result);
1323: }
1324:
1325: /**
1326: * Put all child beans into the beans list.
1327: */
1328: public void childBeans(boolean recursive, java.util.List beans) {
1329: for (java.util.Iterator it = _MetaProperty.iterator(); it
1330: .hasNext();) {
1331: org.netbeans.modules.schema2beansdev.metadd.MetaProperty element = (org.netbeans.modules.schema2beansdev.metadd.MetaProperty) it
1332: .next();
1333: if (element != null) {
1334: if (recursive) {
1335: element.childBeans(true, beans);
1336: }
1337: beans.add(element);
1338: }
1339: }
1340: }
1341:
1342: public boolean equals(Object o) {
1343: return o instanceof org.netbeans.modules.schema2beansdev.metadd.MetaElement
1344: && equals((org.netbeans.modules.schema2beansdev.metadd.MetaElement) o);
1345: }
1346:
1347: public boolean equals(
1348: org.netbeans.modules.schema2beansdev.metadd.MetaElement inst) {
1349: if (inst == this ) {
1350: return true;
1351: }
1352: if (inst == null) {
1353: return false;
1354: }
1355: if (!(_DtdName == null ? inst._DtdName == null : _DtdName
1356: .equals(inst._DtdName))) {
1357: return false;
1358: }
1359: if (!(_Namespace == null ? inst._Namespace == null : _Namespace
1360: .equals(inst._Namespace))) {
1361: return false;
1362: }
1363: if (!(_BeanName == null ? inst._BeanName == null : _BeanName
1364: .equals(inst._BeanName))) {
1365: return false;
1366: }
1367: if (!(_BeanClass == null ? inst._BeanClass == null : _BeanClass
1368: .equals(inst._BeanClass))) {
1369: return false;
1370: }
1371: if (!(_WrapperClass == null ? inst._WrapperClass == null
1372: : _WrapperClass.equals(inst._WrapperClass))) {
1373: return false;
1374: }
1375: if (sizeDefaultValue() != inst.sizeDefaultValue())
1376: return false;
1377: // Compare every element.
1378: for (java.util.Iterator it = _DefaultValue.iterator(), it2 = inst._DefaultValue
1379: .iterator(); it.hasNext() && it2.hasNext();) {
1380: String element = (String) it.next();
1381: String element2 = (String) it2.next();
1382: if (!(element == null ? element2 == null : element
1383: .equals(element2))) {
1384: return false;
1385: }
1386: }
1387: if (sizeKnownValue() != inst.sizeKnownValue())
1388: return false;
1389: // Compare every element.
1390: for (java.util.Iterator it = _KnownValue.iterator(), it2 = inst._KnownValue
1391: .iterator(); it.hasNext() && it2.hasNext();) {
1392: String element = (String) it.next();
1393: String element2 = (String) it2.next();
1394: if (!(element == null ? element2 == null : element
1395: .equals(element2))) {
1396: return false;
1397: }
1398: }
1399: if (sizeMetaProperty() != inst.sizeMetaProperty())
1400: return false;
1401: // Compare every element.
1402: for (java.util.Iterator it = _MetaProperty.iterator(), it2 = inst._MetaProperty
1403: .iterator(); it.hasNext() && it2.hasNext();) {
1404: org.netbeans.modules.schema2beansdev.metadd.MetaProperty element = (org.netbeans.modules.schema2beansdev.metadd.MetaProperty) it
1405: .next();
1406: org.netbeans.modules.schema2beansdev.metadd.MetaProperty element2 = (org.netbeans.modules.schema2beansdev.metadd.MetaProperty) it2
1407: .next();
1408: if (!(element == null ? element2 == null : element
1409: .equals(element2))) {
1410: return false;
1411: }
1412: }
1413: if (sizeComparatorClass() != inst.sizeComparatorClass())
1414: return false;
1415: // Compare every element.
1416: for (java.util.Iterator it = _ComparatorClass.iterator(), it2 = inst._ComparatorClass
1417: .iterator(); it.hasNext() && it2.hasNext();) {
1418: String element = (String) it.next();
1419: String element2 = (String) it2.next();
1420: if (!(element == null ? element2 == null : element
1421: .equals(element2))) {
1422: return false;
1423: }
1424: }
1425: if (!(_Implements == null ? inst._Implements == null
1426: : _Implements.equals(inst._Implements))) {
1427: return false;
1428: }
1429: if (!(_Extends == null ? inst._Extends == null : _Extends
1430: .equals(inst._Extends))) {
1431: return false;
1432: }
1433: if (sizeImport() != inst.sizeImport())
1434: return false;
1435: // Compare every element.
1436: for (java.util.Iterator it = _Import.iterator(), it2 = inst._Import
1437: .iterator(); it.hasNext() && it2.hasNext();) {
1438: String element = (String) it.next();
1439: String element2 = (String) it2.next();
1440: if (!(element == null ? element2 == null : element
1441: .equals(element2))) {
1442: return false;
1443: }
1444: }
1445: if (!(_UserCode == null ? inst._UserCode == null : _UserCode
1446: .equals(inst._UserCode))) {
1447: return false;
1448: }
1449: if (_isSet_Vetoable != inst._isSet_Vetoable) {
1450: return false;
1451: }
1452: if (_isSet_Vetoable) {
1453: if (!(_Vetoable == inst._Vetoable)) {
1454: return false;
1455: }
1456: }
1457: if (_isSet_SkipGeneration != inst._isSet_SkipGeneration) {
1458: return false;
1459: }
1460: if (_isSet_SkipGeneration) {
1461: if (!(_SkipGeneration == inst._SkipGeneration)) {
1462: return false;
1463: }
1464: }
1465: if (!(_DelegatorName == null ? inst._DelegatorName == null
1466: : _DelegatorName.equals(inst._DelegatorName))) {
1467: return false;
1468: }
1469: if (!(_DelegatorExtends == null ? inst._DelegatorExtends == null
1470: : _DelegatorExtends.equals(inst._DelegatorExtends))) {
1471: return false;
1472: }
1473: if (!(_BeanInterfaceExtends == null ? inst._BeanInterfaceExtends == null
1474: : _BeanInterfaceExtends
1475: .equals(inst._BeanInterfaceExtends))) {
1476: return false;
1477: }
1478: if (_isSet_CanBeEmpty != inst._isSet_CanBeEmpty) {
1479: return false;
1480: }
1481: if (_isSet_CanBeEmpty) {
1482: if (!(_CanBeEmpty == inst._CanBeEmpty)) {
1483: return false;
1484: }
1485: }
1486: return true;
1487: }
1488:
1489: public int hashCode() {
1490: int result = 17;
1491: result = 37 * result
1492: + (_DtdName == null ? 0 : _DtdName.hashCode());
1493: result = 37 * result
1494: + (_Namespace == null ? 0 : _Namespace.hashCode());
1495: result = 37 * result
1496: + (_BeanName == null ? 0 : _BeanName.hashCode());
1497: result = 37 * result
1498: + (_BeanClass == null ? 0 : _BeanClass.hashCode());
1499: result = 37
1500: * result
1501: + (_WrapperClass == null ? 0 : _WrapperClass.hashCode());
1502: result = 37
1503: * result
1504: + (_DefaultValue == null ? 0 : _DefaultValue.hashCode());
1505: result = 37 * result
1506: + (_KnownValue == null ? 0 : _KnownValue.hashCode());
1507: result = 37
1508: * result
1509: + (_MetaProperty == null ? 0 : _MetaProperty.hashCode());
1510: result = 37
1511: * result
1512: + (_ComparatorClass == null ? 0 : _ComparatorClass
1513: .hashCode());
1514: result = 37 * result
1515: + (_Implements == null ? 0 : _Implements.hashCode());
1516: result = 37 * result
1517: + (_Extends == null ? 0 : _Extends.hashCode());
1518: result = 37 * result
1519: + (_Import == null ? 0 : _Import.hashCode());
1520: result = 37 * result
1521: + (_UserCode == null ? 0 : _UserCode.hashCode());
1522: result = 37 * result
1523: + (_isSet_Vetoable ? 0 : (_Vetoable ? 0 : 1));
1524: result = 37
1525: * result
1526: + (_isSet_SkipGeneration ? 0
1527: : (_SkipGeneration ? 0 : 1));
1528: result = 37
1529: * result
1530: + (_DelegatorName == null ? 0 : _DelegatorName
1531: .hashCode());
1532: result = 37
1533: * result
1534: + (_DelegatorExtends == null ? 0 : _DelegatorExtends
1535: .hashCode());
1536: result = 37
1537: * result
1538: + (_BeanInterfaceExtends == null ? 0
1539: : _BeanInterfaceExtends.hashCode());
1540: result = 37 * result
1541: + (_isSet_CanBeEmpty ? 0 : (_CanBeEmpty ? 0 : 1));
1542: return result;
1543: }
1544:
1545: public String toString() {
1546: java.io.StringWriter sw = new java.io.StringWriter();
1547: try {
1548: writeNode(sw);
1549: } catch (java.io.IOException e) {
1550: // How can we actually get an IOException on a StringWriter?
1551: throw new RuntimeException(e);
1552: }
1553: return sw.toString();
1554: }
1555:
1556: }
1557:
1558: /*
1559: The following schema file has been used for generation:
1560:
1561: <!-- This holds data about the schema that is not part of DTDs and/or XML Schemas.
1562: -->
1563:
1564: <!--
1565: -->
1566: <!ELEMENT metaDD (meta-element*, implements?, extends?, import*, vetoable?, throw-exceptions?, schemaLocation?, finder*)>
1567:
1568: <!--
1569: -->
1570: <!ELEMENT meta-element (dtd-name, namespace?, bean-name?, bean-class?, wrapper-class?, default-value*, known-value*, meta-property*, comparator-class*, implements?, extends?, import*, user-code?, vetoable?, skip-generation?, delegator-name?, delegator-extends?, bean-interface-extends?, can-be-empty?>
1571:
1572: <!--
1573: -->
1574: <!ELEMENT meta-property (bean-name, default-value*, known-value*, key?, vetoable?)>
1575:
1576: <!ELEMENT delegator-name (#PCDATA)>
1577:
1578: <!--
1579: -->
1580: <!ELEMENT implements (#PCDATA)>
1581:
1582: <!--
1583: -->
1584: <!ELEMENT extends (#PCDATA)>
1585:
1586: <!--
1587: -->
1588: <!ELEMENT import (#PCDATA)>
1589:
1590: <!--
1591: -->
1592: <!ELEMENT dtd-name (#PCDATA)>
1593:
1594: <!ELEMENT namespace (#PCDATA)>
1595:
1596: <!--
1597: -->
1598: <!ELEMENT default-value (#PCDATA)>
1599:
1600: <!--
1601: -->
1602: <!ELEMENT skip-generation EMPTY>
1603:
1604: <!--
1605: -->
1606: <!ELEMENT key EMPTY>
1607:
1608: <!--
1609: -->
1610: <!ELEMENT vetoable EMPTY>
1611:
1612: <!--
1613: -->
1614: <!ELEMENT known-value (#PCDATA)>
1615:
1616: <!--
1617: -->
1618: <!ELEMENT bean-name (#PCDATA)>
1619:
1620: <!--
1621: -->
1622: <!ELEMENT bean-class (#PCDATA)>
1623:
1624: <!--
1625: -->
1626: <!ELEMENT wrapper-class (#PCDATA)>
1627:
1628: <!--
1629: -->
1630: <!ELEMENT comparator-class (#PCDATA)>
1631:
1632: <!--
1633: -->
1634: <!ELEMENT user-code (#PCDATA)>
1635:
1636: <!ELEMENT throw-exceptions EMPTY>
1637:
1638: <!-- Automatically set the schemaLocation -->
1639: <!ELEMENT schemaLocation (#PCDATA)>
1640:
1641: <!ELEMENT finder (#PCDATA)>
1642:
1643: <!ELEMENT bean-interface-extends (#PCDATA)>
1644:
1645: <!ELEMENT can-be-empty EMPTY>
1646:
1647: */
|