KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > schema2beansdev > beangraph > BeanGraph


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  * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 /**
20  * This generated bean class BeanGraph
21  * matches the schema element 'bean-graph'.
22  *
23  *
24  * This class matches the root element of the XML Schema,
25  * and is the root of the bean graph.
26  *
27  * beanGraph <bean-graph> : BeanGraph
28  * schemaTypeMapping <schema-type-mapping> : SchemaTypeMappingType[0,n]
29  * schemaTypeNamespace <schema-type-namespace> : java.lang.String[0,1]
30  * schemaTypeName <schema-type-name> : java.lang.String
31  * javaType <java-type> : java.lang.String
32  * root <root> : boolean[0,1]
33  * bean <bean> : boolean[0,1]
34  * canBeEmpty <can-be-empty> : boolean[0,1]
35  *
36  * @Generated
37  */

38
39 package org.netbeans.modules.schema2beansdev.beangraph;
40
41 public class BeanGraph implements org.netbeans.modules.schema2beansdev.beangraph.CommonBean {
42     public static final String JavaDoc SCHEMA_TYPE_MAPPING = "SchemaTypeMapping"; // NOI18N
43

44     private java.util.List JavaDoc _SchemaTypeMapping = new java.util.ArrayList JavaDoc(); // List<SchemaTypeMappingType>
45
private java.lang.String JavaDoc schemaLocation;
46
47     /**
48      * Normal starting point constructor.
49      */

50     public BeanGraph() {
51     }
52
53     /**
54      * Deep copy
55      */

56     public BeanGraph(org.netbeans.modules.schema2beansdev.beangraph.BeanGraph source) {
57         this(source, false);
58     }
59
60     /**
61      * Deep copy
62      * @param justData just copy the XML relevant data
63      */

64     public BeanGraph(org.netbeans.modules.schema2beansdev.beangraph.BeanGraph source, boolean justData) {
65         for (java.util.Iterator JavaDoc it = source._SchemaTypeMapping.iterator();
66             it.hasNext(); ) {
67             org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType srcElement = (org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType)it.next();
68             _SchemaTypeMapping.add((srcElement == null) ? null : newSchemaTypeMappingType(srcElement, justData));
69         }
70         schemaLocation = source.schemaLocation;
71     }
72
73     // This attribute is an array, possibly empty
74
public void setSchemaTypeMapping(org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType[] value) {
75         if (value == null)
76             value = new SchemaTypeMappingType[0];
77         _SchemaTypeMapping.clear();
78         ((java.util.ArrayList JavaDoc) _SchemaTypeMapping).ensureCapacity(value.length);
79         for (int i = 0; i < value.length; ++i) {
80             _SchemaTypeMapping.add(value[i]);
81         }
82     }
83
84     public void setSchemaTypeMapping(int index, org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType value) {
85         _SchemaTypeMapping.set(index, value);
86     }
87
88     public org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType[] getSchemaTypeMapping() {
89         SchemaTypeMappingType[] arr = new SchemaTypeMappingType[_SchemaTypeMapping.size()];
90         return (SchemaTypeMappingType[]) _SchemaTypeMapping.toArray(arr);
91     }
92
93     public java.util.List JavaDoc fetchSchemaTypeMappingList() {
94         return _SchemaTypeMapping;
95     }
96
97     public org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType getSchemaTypeMapping(int index) {
98         return (SchemaTypeMappingType)_SchemaTypeMapping.get(index);
99     }
100
101     // Return the number of schemaTypeMapping
102
public int sizeSchemaTypeMapping() {
103         return _SchemaTypeMapping.size();
104     }
105
106     public int addSchemaTypeMapping(org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType value) {
107         _SchemaTypeMapping.add(value);
108         int positionOfNewItem = _SchemaTypeMapping.size()-1;
109         return positionOfNewItem;
110     }
111
112     /**
113      * Search from the end looking for @param value, and then remove it.
114      */

115     public int removeSchemaTypeMapping(org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType value) {
116         int pos = _SchemaTypeMapping.indexOf(value);
117         if (pos >= 0) {
118             _SchemaTypeMapping.remove(pos);
119         }
120         return pos;
121     }
122
123     public void _setSchemaLocation(String JavaDoc location) {
124         schemaLocation = location;
125     }
126
127     public String JavaDoc _getSchemaLocation() {
128         return schemaLocation;
129     }
130
131     /**
132      * Create a new bean using it's default constructor.
133      * This does not add it to any bean graph.
134      */

135     public org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType newSchemaTypeMappingType() {
136         return new org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType();
137     }
138
139     /**
140      * Create a new bean, copying from another one.
141      * This does not add it to any bean graph.
142      */

143     public org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType newSchemaTypeMappingType(SchemaTypeMappingType source, boolean justData) {
144         return new org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType(source, justData);
145     }
146
147     public void write(java.io.File JavaDoc f) throws java.io.IOException JavaDoc {
148         java.io.OutputStream JavaDoc out = new java.io.FileOutputStream JavaDoc(f);
149         try {
150             write(out);
151         } finally {
152             out.close();
153         }
154     }
155
156     public void write(java.io.OutputStream JavaDoc out) throws java.io.IOException JavaDoc {
157         write(out, null);
158     }
159
160     public void write(java.io.OutputStream JavaDoc out, String JavaDoc encoding) throws java.io.IOException JavaDoc {
161         java.io.Writer JavaDoc w;
162         if (encoding == null) {
163             encoding = "UTF-8"; // NOI18N
164
}
165         w = new java.io.BufferedWriter JavaDoc(new java.io.OutputStreamWriter JavaDoc(out, encoding));
166         write(w, encoding);
167         w.flush();
168     }
169
170     /**
171      * Print this Java Bean to @param out including an XML header.
172      * @param encoding is the encoding style that @param out was opened with.
173      */

174     public void write(java.io.Writer JavaDoc out, String JavaDoc encoding) throws java.io.IOException JavaDoc {
175         out.write("<?xml version='1.0'"); // NOI18N
176
if (encoding != null)
177             out.write(" encoding='"+encoding+"'"); // NOI18N
178
out.write(" ?>\n"); // NOI18N
179
writeNode(out, "bean-graph", ""); // NOI18N
180
}
181
182     public void writeNode(java.io.Writer JavaDoc out) throws java.io.IOException JavaDoc {
183         String JavaDoc myName;
184         myName = "bean-graph";
185         writeNode(out, myName, ""); // NOI18N
186
}
187
188     public void writeNode(java.io.Writer JavaDoc out, String JavaDoc nodeName, String JavaDoc indent) throws java.io.IOException JavaDoc {
189         writeNode(out, nodeName, null, indent, new java.util.HashMap JavaDoc());
190     }
191
192     /**
193      * It's not recommended to call this method directly.
194      */

195     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 {
196         out.write(indent);
197         out.write("<");
198         if (namespace != null) {
199             out.write((String JavaDoc)namespaceMap.get(namespace));
200             out.write(":");
201         }
202         out.write(nodeName);
203         if (schemaLocation != null) {
204             namespaceMap.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
205             out.write(" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='");
206             out.write(schemaLocation);
207             out.write("'"); // NOI18N
208
}
209         out.write(">\n");
210         String JavaDoc nextIndent = indent + " ";
211         for (java.util.Iterator JavaDoc it = _SchemaTypeMapping.iterator();
212             it.hasNext(); ) {
213             org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType element = (org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType)it.next();
214             if (element != null) {
215                 element.writeNode(out, "schema-type-mapping", null, nextIndent, namespaceMap);
216             }
217         }
218         out.write(indent);
219         out.write("</");
220         if (namespace != null) {
221             out.write((String JavaDoc)namespaceMap.get(namespace));
222             out.write(":");
223         }
224         out.write(nodeName);
225         out.write(">\n");
226     }
227
228     public static BeanGraph read(java.io.File JavaDoc f) throws javax.xml.parsers.ParserConfigurationException JavaDoc, org.xml.sax.SAXException JavaDoc, java.io.IOException JavaDoc {
229         java.io.InputStream JavaDoc in = new java.io.FileInputStream JavaDoc(f);
230         try {
231             return read(in);
232         } finally {
233             in.close();
234         }
235     }
236
237     public static BeanGraph read(java.io.InputStream JavaDoc in) throws javax.xml.parsers.ParserConfigurationException JavaDoc, org.xml.sax.SAXException JavaDoc, java.io.IOException JavaDoc {
238         return read(new org.xml.sax.InputSource JavaDoc(in), false, null, null);
239     }
240
241     /**
242      * Warning: in readNoEntityResolver character and entity references will
243      * not be read from any DTD in the XML source.
244      * However, this way is faster since no DTDs are looked up
245      * (possibly skipping network access) or parsed.
246      */

247     public static BeanGraph readNoEntityResolver(java.io.InputStream JavaDoc in) throws javax.xml.parsers.ParserConfigurationException JavaDoc, org.xml.sax.SAXException JavaDoc, java.io.IOException JavaDoc {
248         return read(new org.xml.sax.InputSource JavaDoc(in), false,
249             new org.xml.sax.EntityResolver JavaDoc() {
250             public org.xml.sax.InputSource JavaDoc resolveEntity(String JavaDoc publicId, String JavaDoc systemId) {
251                 java.io.ByteArrayInputStream JavaDoc bin = new java.io.ByteArrayInputStream JavaDoc(new byte[0]);
252                 return new org.xml.sax.InputSource JavaDoc(bin);
253             }
254         }
255             , null);
256     }
257
258     public static BeanGraph read(org.xml.sax.InputSource JavaDoc in, boolean validate, org.xml.sax.EntityResolver JavaDoc er, org.xml.sax.ErrorHandler JavaDoc eh) throws javax.xml.parsers.ParserConfigurationException JavaDoc, org.xml.sax.SAXException JavaDoc, java.io.IOException JavaDoc {
259         javax.xml.parsers.DocumentBuilderFactory JavaDoc dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance();
260         dbf.setValidating(validate);
261         dbf.setNamespaceAware(true);
262         javax.xml.parsers.DocumentBuilder JavaDoc db = dbf.newDocumentBuilder();
263         if (er != null) db.setEntityResolver(er);
264         if (eh != null) db.setErrorHandler(eh);
265         org.w3c.dom.Document JavaDoc doc = db.parse(in);
266         return read(doc);
267     }
268
269     public static BeanGraph read(org.w3c.dom.Document JavaDoc document) {
270         BeanGraph aBeanGraph = new BeanGraph();
271         aBeanGraph.readFromDocument(document);
272         return aBeanGraph;
273     }
274
275     protected void readFromDocument(org.w3c.dom.Document JavaDoc document) {
276         readNode(document.getDocumentElement());
277     }
278
279     public void readNode(org.w3c.dom.Node JavaDoc node) {
280         readNode(node, new java.util.HashMap JavaDoc());
281     }
282
283     public void readNode(org.w3c.dom.Node JavaDoc node, java.util.Map JavaDoc namespacePrefixes) {
284         if (node.hasAttributes()) {
285             org.w3c.dom.NamedNodeMap JavaDoc attrs = node.getAttributes();
286             org.w3c.dom.Attr JavaDoc attr;
287             java.lang.String JavaDoc attrValue;
288             boolean firstNamespaceDef = true;
289             for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) {
290                 attr = (org.w3c.dom.Attr JavaDoc) attrs.item(attrNum);
291                 String JavaDoc attrName = attr.getName();
292                 if (attrName.startsWith("xmlns:")) {
293                     if (firstNamespaceDef) {
294                         firstNamespaceDef = false;
295                         // Dup prefix map, so as to not write over previous values, and to make it easy to clear out our entries.
296
namespacePrefixes = new java.util.HashMap JavaDoc(namespacePrefixes);
297                     }
298                     String JavaDoc attrNSPrefix = attrName.substring(6, attrName.length());
299                     namespacePrefixes.put(attrNSPrefix, attr.getValue());
300                 }
301             }
302             String JavaDoc xsiPrefix = "xsi";
303             for (java.util.Iterator JavaDoc it = namespacePrefixes.keySet().iterator();
304                 it.hasNext(); ) {
305                 String JavaDoc prefix = (String JavaDoc) it.next();
306                 String JavaDoc ns = (String JavaDoc) namespacePrefixes.get(prefix);
307                 if ("http://www.w3.org/2001/XMLSchema-instance".equals(ns)) {
308                     xsiPrefix = prefix;
309                     break;
310                 }
311             }
312             attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem(""+xsiPrefix+":schemaLocation");
313             if (attr != null) {
314                 attrValue = attr.getValue();
315                 schemaLocation = attrValue;
316             }
317         }
318         org.w3c.dom.NodeList JavaDoc children = node.getChildNodes();
319         for (int i = 0, size = children.getLength(); i < size; ++i) {
320             org.w3c.dom.Node JavaDoc childNode = children.item(i);
321             String JavaDoc childNodeName = (childNode.getLocalName() == null ? childNode.getNodeName().intern() : childNode.getLocalName().intern());
322             String JavaDoc childNodeValue = "";
323             if (childNode.getFirstChild() != null) {
324                 childNodeValue = childNode.getFirstChild().getNodeValue();
325             }
326             if (childNodeName == "schema-type-mapping") {
327                 SchemaTypeMappingType aSchemaTypeMapping = newSchemaTypeMappingType();
328                 aSchemaTypeMapping.readNode(childNode, namespacePrefixes);
329                 _SchemaTypeMapping.add(aSchemaTypeMapping);
330             }
331             else {
332                 // Found extra unrecognized childNode
333
}
334         }
335     }
336
337     /**
338      * Takes some text to be printed into an XML stream and escapes any
339      * characters that might make it invalid XML (like '<').
340      */

341     public static void writeXML(java.io.Writer JavaDoc out, String JavaDoc msg) throws java.io.IOException JavaDoc {
342         writeXML(out, msg, true);
343     }
344
345     public static void writeXML(java.io.Writer JavaDoc out, String JavaDoc msg, boolean attribute) throws java.io.IOException JavaDoc {
346         if (msg == null)
347             return;
348         int msgLength = msg.length();
349         for (int i = 0; i < msgLength; ++i) {
350             char c = msg.charAt(i);
351             writeXML(out, c, attribute);
352         }
353     }
354
355     public static void writeXML(java.io.Writer JavaDoc out, char msg, boolean attribute) throws java.io.IOException JavaDoc {
356         if (msg == '&')
357             out.write("&amp;");
358         else if (msg == '<')
359             out.write("&lt;");
360         else if (msg == '>')
361             out.write("&gt;");
362         else if (attribute) {
363             if (msg == '"')
364                 out.write("&quot;");
365             else if (msg == '\'')
366                 out.write("&apos;");
367             else if (msg == '\n')
368                 out.write("&#xA;");
369             else if (msg == '\t')
370                 out.write("&#x9;");
371             else
372                 out.write(msg);
373         }
374         else
375             out.write(msg);
376     }
377
378     public static class ValidateException extends Exception JavaDoc {
379         private org.netbeans.modules.schema2beansdev.beangraph.CommonBean failedBean;
380         private String JavaDoc failedPropertyName;
381         private FailureType failureType;
382         public ValidateException(String JavaDoc msg, String JavaDoc failedPropertyName, org.netbeans.modules.schema2beansdev.beangraph.CommonBean failedBean) {
383             super(msg);
384             this.failedBean = failedBean;
385             this.failedPropertyName = failedPropertyName;
386         }
387         public ValidateException(String JavaDoc msg, FailureType ft, String JavaDoc failedPropertyName, org.netbeans.modules.schema2beansdev.beangraph.CommonBean failedBean) {
388             super(msg);
389             this.failureType = ft;
390             this.failedBean = failedBean;
391             this.failedPropertyName = failedPropertyName;
392         }
393         public String JavaDoc getFailedPropertyName() {return failedPropertyName;}
394         public FailureType getFailureType() {return failureType;}
395         public org.netbeans.modules.schema2beansdev.beangraph.CommonBean getFailedBean() {return failedBean;}
396         public static class FailureType {
397             private final String JavaDoc name;
398             private FailureType(String JavaDoc name) {this.name = name;}
399             public String JavaDoc toString() { return name;}
400             public static final FailureType NULL_VALUE = new FailureType("NULL_VALUE");
401             public static final FailureType DATA_RESTRICTION = new FailureType("DATA_RESTRICTION");
402             public static final FailureType ENUM_RESTRICTION = new FailureType("ENUM_RESTRICTION");
403             public static final FailureType ALL_RESTRICTIONS = new FailureType("ALL_RESTRICTIONS");
404             public static final FailureType MUTUALLY_EXCLUSIVE = new FailureType("MUTUALLY_EXCLUSIVE");
405         }
406     }
407
408     public void validate() throws org.netbeans.modules.schema2beansdev.beangraph.BeanGraph.ValidateException {
409         boolean restrictionFailure = false;
410         boolean restrictionPassed = false;
411         // Validating property schemaTypeMapping
412
for (int _index = 0; _index < sizeSchemaTypeMapping(); ++_index) {
413             org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType element = getSchemaTypeMapping(_index);
414             if (element != null) {
415                 element.validate();
416             }
417         }
418     }
419
420     public void changePropertyByName(String JavaDoc name, Object JavaDoc value) {
421         if (name == null) return;
422         name = name.intern();
423         if (name == "schemaTypeMapping")
424             addSchemaTypeMapping((SchemaTypeMappingType)value);
425         else if (name == "schemaTypeMapping[]")
426             setSchemaTypeMapping((SchemaTypeMappingType[]) value);
427         else
428             throw new IllegalArgumentException JavaDoc(name+" is not a valid property name for BeanGraph");
429     }
430
431     public Object JavaDoc fetchPropertyByName(String JavaDoc name) {
432         if (name == "schemaTypeMapping[]")
433             return getSchemaTypeMapping();
434         throw new IllegalArgumentException JavaDoc(name+" is not a valid property name for BeanGraph");
435     }
436
437     public String JavaDoc nameSelf() {
438         return "/BeanGraph";
439     }
440
441     public String JavaDoc nameChild(Object JavaDoc childObj) {
442         return nameChild(childObj, false, false);
443     }
444
445     /**
446      * @param childObj The child object to search for
447      * @param returnSchemaName Whether or not the schema name should be returned or the property name
448      * @return null if not found
449      */

450     public String JavaDoc nameChild(Object JavaDoc childObj, boolean returnConstName, boolean returnSchemaName) {
451         return nameChild(childObj, returnConstName, returnSchemaName, false);
452     }
453
454     /**
455      * @param childObj The child object to search for
456      * @param returnSchemaName Whether or not the schema name should be returned or the property name
457      * @return null if not found
458      */

459     public String JavaDoc nameChild(Object JavaDoc childObj, boolean returnConstName, boolean returnSchemaName, boolean returnXPathName) {
460         if (childObj instanceof SchemaTypeMappingType) {
461             SchemaTypeMappingType child = (SchemaTypeMappingType) childObj;
462             int index = 0;
463             for (java.util.Iterator JavaDoc it = _SchemaTypeMapping.iterator();
464                 it.hasNext(); ) {
465                 org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType element = (org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType)it.next();
466                 if (child == element) {
467                     if (returnConstName) {
468                         return SCHEMA_TYPE_MAPPING;
469                     } else if (returnSchemaName) {
470                         return "schema-type-mapping";
471                     } else if (returnXPathName) {
472                         return "schema-type-mapping[position()="+index+"]";
473                     } else {
474                         return "SchemaTypeMapping."+Integer.toHexString(index);
475                     }
476                 }
477                 ++index;
478             }
479         }
480         return null;
481     }
482
483     /**
484      * Return an array of all of the properties that are beans and are set.
485      */

486     public org.netbeans.modules.schema2beansdev.beangraph.CommonBean[] childBeans(boolean recursive) {
487         java.util.List JavaDoc children = new java.util.LinkedList JavaDoc();
488         childBeans(recursive, children);
489         org.netbeans.modules.schema2beansdev.beangraph.CommonBean[] result = new org.netbeans.modules.schema2beansdev.beangraph.CommonBean[children.size()];
490         return (org.netbeans.modules.schema2beansdev.beangraph.CommonBean[]) children.toArray(result);
491     }
492
493     /**
494      * Put all child beans into the beans list.
495      */

496     public void childBeans(boolean recursive, java.util.List JavaDoc beans) {
497         for (java.util.Iterator JavaDoc it = _SchemaTypeMapping.iterator();
498             it.hasNext(); ) {
499             org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType element = (org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType)it.next();
500             if (element != null) {
501                 if (recursive) {
502                     element.childBeans(true, beans);
503                 }
504                 beans.add(element);
505             }
506         }
507     }
508
509     public boolean equals(Object JavaDoc o) {
510         return o instanceof org.netbeans.modules.schema2beansdev.beangraph.BeanGraph && equals((org.netbeans.modules.schema2beansdev.beangraph.BeanGraph) o);
511     }
512
513     public boolean equals(org.netbeans.modules.schema2beansdev.beangraph.BeanGraph inst) {
514         if (inst == this) {
515             return true;
516         }
517         if (inst == null) {
518             return false;
519         }
520         if (sizeSchemaTypeMapping() != inst.sizeSchemaTypeMapping())
521             return false;
522         // Compare every element.
523
for (java.util.Iterator JavaDoc it = _SchemaTypeMapping.iterator(), it2 = inst._SchemaTypeMapping.iterator();
524             it.hasNext() && it2.hasNext(); ) {
525             org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType element = (org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType)it.next();
526             org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType element2 = (org.netbeans.modules.schema2beansdev.beangraph.SchemaTypeMappingType)it2.next();
527             if (!(element == null ? element2 == null : element.equals(element2))) {
528                 return false;
529             }
530         }
531         return true;
532     }
533
534     public int hashCode() {
535         int result = 17;
536         result = 37*result + (_SchemaTypeMapping == null ? 0 : _SchemaTypeMapping.hashCode());
537         return result;
538     }
539
540     public String JavaDoc toString() {
541         java.io.StringWriter JavaDoc sw = new java.io.StringWriter JavaDoc();
542         try {
543             writeNode(sw);
544         } catch (java.io.IOException JavaDoc e) {
545             // How can we actually get an IOException on a StringWriter?
546
throw new RuntimeException JavaDoc(e);
547         }
548         return sw.toString();
549     }
550
551 }
552
553
554 /*
555         The following schema file has been used for generation:
556
557 <?xml version="1.0" ?>
558
559 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
560   <xsd:element name="bean-graph">
561     <xsd:complexType>
562       <xsd:sequence>
563         <xsd:element name="schema-type-mapping" type="schemaTypeMappingType"
564           minOccurs="0" maxOccurs="unbounded"/>
565       </xsd:sequence>
566     </xsd:complexType>
567   </xsd:element>
568
569   <xsd:complexType name="schemaTypeMappingType">
570     <xsd:annotation>
571       <xsd:documentation>
572         Map between schema types and java types.
573       </xsd:documentation>
574     </xsd:annotation>
575     <xsd:sequence>
576       <xsd:element name="schema-type-namespace" type="xsd:string" minOccurs="0"/>
577       <xsd:element name="schema-type-name" type="xsd:string">
578         <xsd:annotation>
579           <xsd:documentation>
580             The schema type; for instance, "string"
581           </xsd:documentation>
582         </xsd:annotation>
583       </xsd:element>
584       <xsd:element name="java-type" type="xsd:string">
585         <xsd:annotation>
586           <xsd:documentation>
587             The java type; for instance, "java.lang.String", or "int"
588           </xsd:documentation>
589         </xsd:annotation>
590       </xsd:element>
591       <xsd:element name="root" type="xsd:boolean" minOccurs="0"/>
592       <xsd:element name="bean" type="xsd:boolean" minOccurs="0"/>
593       <xsd:element name="can-be-empty" type="xsd:boolean" minOccurs="0"/>
594     </xsd:sequence>
595   </xsd:complexType>
596 </xsd:schema>
597
598 */

599
Popular Tags