KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > ui > view > wizard > ExtensionAttrType


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /**
21  * This generated bean class ExtensionAttrType
22  * matches the schema element 'extensionAttrType'.
23  * The root bean class is TemplateGroup
24  *
25  * Generated on Thu Sep 14 11:59:07 PDT 2006
26  * @Generated
27  */

28
29 package org.netbeans.modules.xml.wsdl.ui.view.wizard;
30
31 public class ExtensionAttrType {
32     public static final String JavaDoc NAME = "Name"; // NOI18N
33
public static final String JavaDoc DEFAULTVALUE = "DefaultValue"; // NOI18N
34

35     private java.lang.String JavaDoc _Name;
36     private java.lang.String JavaDoc _DefaultValue;
37
38     /**
39      * Normal starting point constructor.
40      */

41     public ExtensionAttrType() {
42     }
43
44     /**
45      * Deep copy
46      */

47     public ExtensionAttrType(org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionAttrType source) {
48         this(source, false);
49     }
50
51     /**
52      * Deep copy
53      * @param justData just copy the XML relevant data
54      */

55     public ExtensionAttrType(org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionAttrType source, boolean justData) {
56         _Name = source._Name;
57         _DefaultValue = source._DefaultValue;
58     }
59
60     // This attribute is optional
61
public void setName(java.lang.String JavaDoc value) {
62         _Name = value;
63     }
64
65     public java.lang.String JavaDoc getName() {
66         return _Name;
67     }
68
69     // This attribute is optional
70
public void setDefaultValue(java.lang.String JavaDoc value) {
71         _DefaultValue = value;
72     }
73
74     public java.lang.String JavaDoc getDefaultValue() {
75         return _DefaultValue;
76     }
77
78     public void writeNode(java.io.Writer JavaDoc out) throws java.io.IOException JavaDoc {
79         String JavaDoc myName;
80         myName = "extensionAttrType";
81         writeNode(out, myName, ""); // NOI18N
82
}
83
84     public void writeNode(java.io.Writer JavaDoc out, String JavaDoc nodeName, String JavaDoc indent) throws java.io.IOException JavaDoc {
85         writeNode(out, nodeName, null, indent, new java.util.HashMap JavaDoc());
86     }
87
88     /**
89      * It's not recommended to call this method directly.
90      */

91     public void writeNode(java.io.Writer JavaDoc out, String JavaDoc nodeName, String JavaDoc namespace, String JavaDoc indent, java.util.Map JavaDoc namespaceMap) throws java.io.IOException JavaDoc {
92         out.write(indent);
93         out.write("<");
94         if (namespace != null) {
95             out.write((String JavaDoc)namespaceMap.get(namespace));
96             out.write(":");
97         }
98         out.write(nodeName);
99         writeNodeAttributes(out, nodeName, namespace, indent, namespaceMap);
100         writeNodeChildren(out, nodeName, namespace, indent, namespaceMap);
101         out.write("/>\n");
102     }
103
104     protected void writeNodeAttributes(java.io.Writer JavaDoc out, String JavaDoc nodeName, String JavaDoc namespace, String JavaDoc indent, java.util.Map JavaDoc namespaceMap) throws java.io.IOException JavaDoc {
105         // name is an attribute with namespace http://xml.netbeans.org/schema/templates
106
if (_Name != null) {
107             out.write(" name='");
108             org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateGroup.writeXML(out, _Name, true);
109             out.write("'"); // NOI18N
110
}
111         // defaultValue is an attribute with namespace http://xml.netbeans.org/schema/templates
112
if (_DefaultValue != null) {
113             out.write(" defaultValue='");
114             org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateGroup.writeXML(out, _DefaultValue, true);
115             out.write("'"); // NOI18N
116
}
117     }
118
119     protected void writeNodeChildren(java.io.Writer JavaDoc out, String JavaDoc nodeName, String JavaDoc namespace, String JavaDoc indent, java.util.Map JavaDoc namespaceMap) throws java.io.IOException JavaDoc {
120     }
121
122     public void readNode(org.w3c.dom.Node JavaDoc node) {
123         readNode(node, new java.util.HashMap JavaDoc());
124     }
125
126     public void readNode(org.w3c.dom.Node JavaDoc node, java.util.Map JavaDoc namespacePrefixes) {
127         if (node.hasAttributes()) {
128             org.w3c.dom.NamedNodeMap JavaDoc attrs = node.getAttributes();
129             org.w3c.dom.Attr JavaDoc attr;
130             java.lang.String JavaDoc attrValue;
131             boolean firstNamespaceDef = true;
132             for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) {
133                 attr = (org.w3c.dom.Attr JavaDoc) attrs.item(attrNum);
134                 String JavaDoc attrName = attr.getName();
135                 if (attrName.startsWith("xmlns:")) {
136                     if (firstNamespaceDef) {
137                         firstNamespaceDef = false;
138                         // Dup prefix map, so as to not write over previous values, and to make it easy to clear out our entries.
139
namespacePrefixes = new java.util.HashMap JavaDoc(namespacePrefixes);
140                     }
141                     String JavaDoc attrNSPrefix = attrName.substring(6, attrName.length());
142                     namespacePrefixes.put(attrNSPrefix, attr.getValue());
143                 }
144             }
145             readNodeAttributes(node, namespacePrefixes, attrs);
146         }
147         readNodeChildren(node, namespacePrefixes);
148     }
149
150     protected void readNodeAttributes(org.w3c.dom.Node JavaDoc node, java.util.Map JavaDoc namespacePrefixes, org.w3c.dom.NamedNodeMap JavaDoc attrs) {
151         org.w3c.dom.Attr JavaDoc attr;
152         java.lang.String JavaDoc attrValue;
153         attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("name");
154         if (attr != null) {
155             attrValue = attr.getValue();
156             _Name = attrValue;
157         }
158         attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("defaultValue");
159         if (attr != null) {
160             attrValue = attr.getValue();
161             _DefaultValue = attrValue;
162         }
163     }
164
165     protected void readNodeChildren(org.w3c.dom.Node JavaDoc node, java.util.Map JavaDoc namespacePrefixes) {
166     }
167
168     public void changePropertyByName(String JavaDoc name, Object JavaDoc value) {
169         if (name == null) return;
170         name = name.intern();
171         if (name == "name")
172             setName((java.lang.String JavaDoc)value);
173         else if (name == "defaultValue")
174             setDefaultValue((java.lang.String JavaDoc)value);
175         else
176             throw new IllegalArgumentException JavaDoc(name+" is not a valid property name for ExtensionAttrType");
177     }
178
179     public Object JavaDoc fetchPropertyByName(String JavaDoc name) {
180         if (name == "name")
181             return getName();
182         if (name == "defaultValue")
183             return getDefaultValue();
184         throw new IllegalArgumentException JavaDoc(name+" is not a valid property name for ExtensionAttrType");
185     }
186
187     public String JavaDoc nameSelf() {
188         return "ExtensionAttrType";
189     }
190
191     public String JavaDoc nameChild(Object JavaDoc childObj) {
192         return nameChild(childObj, false, false);
193     }
194
195     /**
196      * @param childObj The child object to search for
197      * @param returnSchemaName Whether or not the schema name should be returned or the property name
198      * @return null if not found
199      */

200     public String JavaDoc nameChild(Object JavaDoc childObj, boolean returnConstName, boolean returnSchemaName) {
201         return nameChild(childObj, returnConstName, returnSchemaName, false);
202     }
203
204     /**
205      * @param childObj The child object to search for
206      * @param returnSchemaName Whether or not the schema name should be returned or the property name
207      * @return null if not found
208      */

209     public String JavaDoc nameChild(Object JavaDoc childObj, boolean returnConstName, boolean returnSchemaName, boolean returnXPathName) {
210         if (childObj instanceof java.lang.String JavaDoc) {
211             java.lang.String JavaDoc child = (java.lang.String JavaDoc) childObj;
212             if (child == _Name) {
213                 if (returnConstName) {
214                     return NAME;
215                 } else if (returnSchemaName) {
216                     return "name";
217                 } else if (returnXPathName) {
218                     return "@name";
219                 } else {
220                     return "Name";
221                 }
222             }
223             if (child == _DefaultValue) {
224                 if (returnConstName) {
225                     return DEFAULTVALUE;
226                 } else if (returnSchemaName) {
227                     return "defaultValue";
228                 } else if (returnXPathName) {
229                     return "@defaultValue";
230                 } else {
231                     return "DefaultValue";
232                 }
233             }
234         }
235         return null;
236     }
237
238     /**
239      * Return an array of all of the properties that are beans and are set.
240      */

241     public java.lang.Object JavaDoc[] childBeans(boolean recursive) {
242         java.util.List JavaDoc children = new java.util.LinkedList JavaDoc();
243         childBeans(recursive, children);
244         java.lang.Object JavaDoc[] result = new java.lang.Object JavaDoc[children.size()];
245         return (java.lang.Object JavaDoc[]) children.toArray(result);
246     }
247
248     /**
249      * Put all child beans into the beans list.
250      */

251     public void childBeans(boolean recursive, java.util.List JavaDoc beans) {
252     }
253
254     public boolean equals(Object JavaDoc o) {
255         return o instanceof org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionAttrType && equals((org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionAttrType) o);
256     }
257
258     public boolean equals(org.netbeans.modules.xml.wsdl.ui.view.wizard.ExtensionAttrType inst) {
259         if (inst == this) {
260             return true;
261         }
262         if (inst == null) {
263             return false;
264         }
265         if (!(_Name == null ? inst._Name == null : _Name.equals(inst._Name))) {
266             return false;
267         }
268         if (!(_DefaultValue == null ? inst._DefaultValue == null : _DefaultValue.equals(inst._DefaultValue))) {
269             return false;
270         }
271         return true;
272     }
273
274     public int hashCode() {
275         int result = 17;
276         result = 37*result + (_Name == null ? 0 : _Name.hashCode());
277         result = 37*result + (_DefaultValue == null ? 0 : _DefaultValue.hashCode());
278         return result;
279     }
280
281 }
282
283
284 /*
285         The following schema file has been used for generation:
286
287 <?xml version="1.0" encoding="UTF-8"?>
288
289 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
290             targetNamespace="http://xml.netbeans.org/schema/templates"
291             xmlns:tns="http://xml.netbeans.org/schema/templates"
292             elementFormDefault="qualified">
293     <xsd:element name="templateGroup">
294         <xsd:complexType>
295             <xsd:sequence>
296                 <xsd:element name="template" type="tns:templateType" maxOccurs="unbounded"/>
297             </xsd:sequence>
298             <xsd:attribute name="namespace" type="xsd:string"/>
299             <xsd:attribute name="prefix" type="xsd:string"/>
300         </xsd:complexType>
301     </xsd:element>
302     <xsd:complexType name="templateType">
303         <xsd:sequence>
304             <xsd:element name="wsdlElement" type="tns:wsdlElementType" maxOccurs="unbounded"/>
305         </xsd:sequence>
306         <xsd:attribute name="name" type="xsd:string"/>
307         <xsd:attribute name="default" type="xsd:boolean"/>
308     </xsd:complexType>
309     <xsd:complexType name="wsdlElementType">
310         <xsd:sequence>
311             <xsd:element name="extensionElement" type="tns:extensionElementType" maxOccurs="unbounded"/>
312         </xsd:sequence>
313         <xsd:attribute name="name" type="xsd:string"/>
314     </xsd:complexType>
315     <xsd:complexType name="extensionElementType">
316         <xsd:sequence>
317             <xsd:element name="extensionAttr" type="tns:extensionAttrType" maxOccurs="unbounded"/>
318         </xsd:sequence>
319         <xsd:attribute name="name" type="xsd:string"/>
320     </xsd:complexType>
321     <xsd:complexType name="extensionAttrType">
322         <xsd:attribute name="name" type="xsd:string"/>
323         <xsd:attribute name="defaultValue" type="xsd:string"/>
324     </xsd:complexType>
325 </xsd:schema>
326
327
328 */

329
Popular Tags