001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: /**
043: * This generated bean class ExtensionAttrType
044: * matches the schema element 'extensionAttrType'.
045: * The root bean class is TemplateGroup
046: *
047: * Generated on Thu Sep 14 11:59:07 PDT 2006
048: * @Generated
049: */package org.netbeans.modules.xml.wsdl.bindingsupport.template;
050:
051: public class ExtensionAttrType {
052: public static final String NAME = "Name"; // NOI18N
053: public static final String DEFAULTVALUE = "DefaultValue"; // NOI18N
054:
055: private java.lang.String _Name;
056: private java.lang.String _DefaultValue;
057:
058: /**
059: * Normal starting point constructor.
060: */
061: public ExtensionAttrType() {
062: }
063:
064: /**
065: * Deep copy
066: */
067: public ExtensionAttrType(
068: org.netbeans.modules.xml.wsdl.bindingsupport.template.ExtensionAttrType source) {
069: this (source, false);
070: }
071:
072: /**
073: * Deep copy
074: * @param justData just copy the XML relevant data
075: */
076: public ExtensionAttrType(
077: org.netbeans.modules.xml.wsdl.bindingsupport.template.ExtensionAttrType source,
078: boolean justData) {
079: _Name = source._Name;
080: _DefaultValue = source._DefaultValue;
081: }
082:
083: // This attribute is optional
084: public void setName(java.lang.String value) {
085: _Name = value;
086: }
087:
088: public java.lang.String getName() {
089: return _Name;
090: }
091:
092: // This attribute is optional
093: public void setDefaultValue(java.lang.String value) {
094: _DefaultValue = value;
095: }
096:
097: public java.lang.String getDefaultValue() {
098: return _DefaultValue;
099: }
100:
101: public void writeNode(java.io.Writer out)
102: throws java.io.IOException {
103: String myName;
104: myName = "extensionAttrType";
105: writeNode(out, myName, ""); // NOI18N
106: }
107:
108: public void writeNode(java.io.Writer out, String nodeName,
109: String indent) throws java.io.IOException {
110: writeNode(out, nodeName, null, indent, new java.util.HashMap());
111: }
112:
113: /**
114: * It's not recommended to call this method directly.
115: */
116: public void writeNode(java.io.Writer out, String nodeName,
117: String namespace, String indent, java.util.Map namespaceMap)
118: throws java.io.IOException {
119: out.write(indent);
120: out.write("<");
121: if (namespace != null) {
122: out.write((String) namespaceMap.get(namespace));
123: out.write(":");
124: }
125: out.write(nodeName);
126: writeNodeAttributes(out, nodeName, namespace, indent,
127: namespaceMap);
128: writeNodeChildren(out, nodeName, namespace, indent,
129: namespaceMap);
130: out.write("/>\n");
131: }
132:
133: protected void writeNodeAttributes(java.io.Writer out,
134: String nodeName, String namespace, String indent,
135: java.util.Map namespaceMap) throws java.io.IOException {
136: // name is an attribute with namespace http://xml.netbeans.org/schema/templates
137: if (_Name != null) {
138: out.write(" name='");
139: org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateGroup
140: .writeXML(out, _Name, true);
141: out.write("'"); // NOI18N
142: }
143: // defaultValue is an attribute with namespace http://xml.netbeans.org/schema/templates
144: if (_DefaultValue != null) {
145: out.write(" defaultValue='");
146: org.netbeans.modules.xml.wsdl.bindingsupport.template.TemplateGroup
147: .writeXML(out, _DefaultValue, true);
148: out.write("'"); // NOI18N
149: }
150: }
151:
152: protected void writeNodeChildren(java.io.Writer out,
153: String nodeName, String namespace, String indent,
154: java.util.Map namespaceMap) throws java.io.IOException {
155: }
156:
157: public void readNode(org.w3c.dom.Node node) {
158: readNode(node, new java.util.HashMap());
159: }
160:
161: public void readNode(org.w3c.dom.Node node,
162: java.util.Map namespacePrefixes) {
163: if (node.hasAttributes()) {
164: org.w3c.dom.NamedNodeMap attrs = node.getAttributes();
165: org.w3c.dom.Attr attr;
166: java.lang.String attrValue;
167: boolean firstNamespaceDef = true;
168: for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) {
169: attr = (org.w3c.dom.Attr) attrs.item(attrNum);
170: String attrName = attr.getName();
171: if (attrName.startsWith("xmlns:")) {
172: if (firstNamespaceDef) {
173: firstNamespaceDef = false;
174: // Dup prefix map, so as to not write over previous values, and to make it easy to clear out our entries.
175: namespacePrefixes = new java.util.HashMap(
176: namespacePrefixes);
177: }
178: String attrNSPrefix = attrName.substring(6,
179: attrName.length());
180: namespacePrefixes
181: .put(attrNSPrefix, attr.getValue());
182: }
183: }
184: readNodeAttributes(node, namespacePrefixes, attrs);
185: }
186: readNodeChildren(node, namespacePrefixes);
187: }
188:
189: protected void readNodeAttributes(org.w3c.dom.Node node,
190: java.util.Map namespacePrefixes,
191: org.w3c.dom.NamedNodeMap attrs) {
192: org.w3c.dom.Attr attr;
193: java.lang.String attrValue;
194: attr = (org.w3c.dom.Attr) attrs.getNamedItem("name");
195: if (attr != null) {
196: attrValue = attr.getValue();
197: _Name = attrValue;
198: }
199: attr = (org.w3c.dom.Attr) attrs.getNamedItem("defaultValue");
200: if (attr != null) {
201: attrValue = attr.getValue();
202: _DefaultValue = attrValue;
203: }
204: }
205:
206: protected void readNodeChildren(org.w3c.dom.Node node,
207: java.util.Map namespacePrefixes) {
208: }
209:
210: public void changePropertyByName(String name, Object value) {
211: if (name == null)
212: return;
213: name = name.intern();
214: if (name == "name")
215: setName((java.lang.String) value);
216: else if (name == "defaultValue")
217: setDefaultValue((java.lang.String) value);
218: else
219: throw new IllegalArgumentException(
220: name
221: + " is not a valid property name for ExtensionAttrType");
222: }
223:
224: public Object fetchPropertyByName(String name) {
225: if (name == "name")
226: return getName();
227: if (name == "defaultValue")
228: return getDefaultValue();
229: throw new IllegalArgumentException(name
230: + " is not a valid property name for ExtensionAttrType");
231: }
232:
233: public String nameSelf() {
234: return "ExtensionAttrType";
235: }
236:
237: public String nameChild(Object childObj) {
238: return nameChild(childObj, false, false);
239: }
240:
241: /**
242: * @param childObj The child object to search for
243: * @param returnSchemaName Whether or not the schema name should be returned or the property name
244: * @return null if not found
245: */
246: public String nameChild(Object childObj, boolean returnConstName,
247: boolean returnSchemaName) {
248: return nameChild(childObj, returnConstName, returnSchemaName,
249: false);
250: }
251:
252: /**
253: * @param childObj The child object to search for
254: * @param returnSchemaName Whether or not the schema name should be returned or the property name
255: * @return null if not found
256: */
257: public String nameChild(Object childObj, boolean returnConstName,
258: boolean returnSchemaName, boolean returnXPathName) {
259: if (childObj instanceof java.lang.String) {
260: java.lang.String child = (java.lang.String) childObj;
261: if (child == _Name) {
262: if (returnConstName) {
263: return NAME;
264: } else if (returnSchemaName) {
265: return "name";
266: } else if (returnXPathName) {
267: return "@name";
268: } else {
269: return "Name";
270: }
271: }
272: if (child == _DefaultValue) {
273: if (returnConstName) {
274: return DEFAULTVALUE;
275: } else if (returnSchemaName) {
276: return "defaultValue";
277: } else if (returnXPathName) {
278: return "@defaultValue";
279: } else {
280: return "DefaultValue";
281: }
282: }
283: }
284: return null;
285: }
286:
287: /**
288: * Return an array of all of the properties that are beans and are set.
289: */
290: public java.lang.Object[] childBeans(boolean recursive) {
291: java.util.List children = new java.util.LinkedList();
292: childBeans(recursive, children);
293: java.lang.Object[] result = new java.lang.Object[children
294: .size()];
295: return (java.lang.Object[]) children.toArray(result);
296: }
297:
298: /**
299: * Put all child beans into the beans list.
300: */
301: public void childBeans(boolean recursive, java.util.List beans) {
302: }
303:
304: public boolean equals(Object o) {
305: return o instanceof org.netbeans.modules.xml.wsdl.bindingsupport.template.ExtensionAttrType
306: && equals((org.netbeans.modules.xml.wsdl.bindingsupport.template.ExtensionAttrType) o);
307: }
308:
309: public boolean equals(
310: org.netbeans.modules.xml.wsdl.bindingsupport.template.ExtensionAttrType inst) {
311: if (inst == this ) {
312: return true;
313: }
314: if (inst == null) {
315: return false;
316: }
317: if (!(_Name == null ? inst._Name == null : _Name
318: .equals(inst._Name))) {
319: return false;
320: }
321: if (!(_DefaultValue == null ? inst._DefaultValue == null
322: : _DefaultValue.equals(inst._DefaultValue))) {
323: return false;
324: }
325: return true;
326: }
327:
328: public int hashCode() {
329: int result = 17;
330: result = 37 * result + (_Name == null ? 0 : _Name.hashCode());
331: result = 37
332: * result
333: + (_DefaultValue == null ? 0 : _DefaultValue.hashCode());
334: return result;
335: }
336:
337: }
338:
339: /*
340: The following schema file has been used for generation:
341:
342: <?xml version="1.0" encoding="UTF-8"?>
343:
344: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
345: targetNamespace="http://xml.netbeans.org/schema/templates"
346: xmlns:tns="http://xml.netbeans.org/schema/templates"
347: elementFormDefault="qualified">
348: <xsd:element name="templateGroup">
349: <xsd:complexType>
350: <xsd:sequence>
351: <xsd:element name="template" type="tns:templateType" maxOccurs="unbounded"/>
352: </xsd:sequence>
353: <xsd:attribute name="namespace" type="xsd:string"/>
354: <xsd:attribute name="prefix" type="xsd:string"/>
355: </xsd:complexType>
356: </xsd:element>
357: <xsd:complexType name="templateType">
358: <xsd:sequence>
359: <xsd:element name="wsdlElement" type="tns:wsdlElementType" maxOccurs="unbounded"/>
360: </xsd:sequence>
361: <xsd:attribute name="name" type="xsd:string"/>
362: <xsd:attribute name="default" type="xsd:boolean"/>
363: </xsd:complexType>
364: <xsd:complexType name="wsdlElementType">
365: <xsd:sequence>
366: <xsd:element name="extensionElement" type="tns:extensionElementType" maxOccurs="unbounded"/>
367: </xsd:sequence>
368: <xsd:attribute name="name" type="xsd:string"/>
369: </xsd:complexType>
370: <xsd:complexType name="extensionElementType">
371: <xsd:sequence>
372: <xsd:element name="extensionAttr" type="tns:extensionAttrType" maxOccurs="unbounded"/>
373: </xsd:sequence>
374: <xsd:attribute name="name" type="xsd:string"/>
375: </xsd:complexType>
376: <xsd:complexType name="extensionAttrType">
377: <xsd:attribute name="name" type="xsd:string"/>
378: <xsd:attribute name="defaultValue" type="xsd:string"/>
379: </xsd:complexType>
380: </xsd:schema>
381:
382:
383: */
|