View Javadoc

1   /*
2    =================== DO NOT EDIT THIS FILE ====================
3    Generated by Modello 1.9.0-SNAPSHOT,
4    any modifications will be overwritten.
5    ==============================================================
6    */
7   
8   package org.codehaus.modello.test.features.io.dom4j;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
12  //---------------------------------/
13  
14  import java.io.OutputStream;
15  import java.io.Writer;
16  import java.text.DateFormat;
17  import java.util.Arrays;
18  import java.util.Iterator;
19  import java.util.Locale;
20  import org.codehaus.modello.test.features.Action;
21  import org.codehaus.modello.test.features.AnnotationTest;
22  import org.codehaus.modello.test.features.ArrayFeatures;
23  import org.codehaus.modello.test.features.AssociationFeatures;
24  import org.codehaus.modello.test.features.BaseClass;
25  import org.codehaus.modello.test.features.BidiInList;
26  import org.codehaus.modello.test.features.BidiInSet;
27  import org.codehaus.modello.test.features.Bidirectional;
28  import org.codehaus.modello.test.features.ContentTest;
29  import org.codehaus.modello.test.features.DueTo;
30  import org.codehaus.modello.test.features.Features;
31  import org.codehaus.modello.test.features.File;
32  import org.codehaus.modello.test.features.InterfacesFeature;
33  import org.codehaus.modello.test.features.JavaFeatures;
34  import org.codehaus.modello.test.features.NodeItem;
35  import org.codehaus.modello.test.features.Reference;
36  import org.codehaus.modello.test.features.SimpleInterface;
37  import org.codehaus.modello.test.features.SimpleTypes;
38  import org.codehaus.modello.test.features.SubClassLevel1;
39  import org.codehaus.modello.test.features.SubClassLevel2;
40  import org.codehaus.modello.test.features.SubClassLevel3;
41  import org.codehaus.modello.test.features.SubInterface;
42  import org.codehaus.modello.test.features.SuperThing;
43  import org.codehaus.modello.test.features.Thing;
44  import org.codehaus.modello.test.features.Thingy;
45  import org.codehaus.modello.test.features.XdocFeatures;
46  import org.codehaus.modello.test.features.XmlAttributes;
47  import org.codehaus.modello.test.features.XmlContent;
48  import org.codehaus.modello.test.features.XmlContentLong;
49  import org.codehaus.modello.test.features.XmlContentLongWithAttributes;
50  import org.codehaus.modello.test.features.XmlFeatures;
51  import org.codehaus.modello.test.features.XmlFieldsOrder;
52  import org.codehaus.modello.test.features.XmlFieldsOrderParent;
53  import org.codehaus.modello.test.features.XmlFieldsOrderParent2;
54  import org.codehaus.modello.test.features.XmlTransientFields;
55  import org.codehaus.modello.test.features.XsdFeatures;
56  import org.codehaus.modello.test.features.other.PackageNameFeature;
57  import org.codehaus.modello.test.features.other.SubInterfaceInPackage;
58  import org.codehaus.plexus.util.xml.Xpp3Dom;
59  import org.dom4j.Document;
60  import org.dom4j.DocumentException;
61  import org.dom4j.DocumentFactory;
62  import org.dom4j.Element;
63  import org.dom4j.io.OutputFormat;
64  import org.dom4j.io.XMLWriter;
65  
66  /**
67   * Class ModelloFeaturesTestDom4jWriter.
68   * 
69   * @version $Revision$ $Date$
70   */
71  @SuppressWarnings( "all" )
72  public class ModelloFeaturesTestDom4jWriter
73  {
74  
75        //-----------/
76       //- Methods -/
77      //-----------/
78  
79      /**
80       * Method write.
81       * 
82       * @param writer
83       * @param features
84       * @throws java.io.IOException
85       */
86      public void write( Writer writer, Features features )
87          throws java.io.IOException
88      {
89          Document document = new DocumentFactory().createDocument();
90          writeFeatures( features, "features-demo", document );
91          OutputFormat format = OutputFormat.createPrettyPrint();
92          format.setLineSeparator( System.getProperty( "line.separator" ) );
93          XMLWriter serializer = new XMLWriter( writer, format );
94          serializer.write( document );
95      } //-- void write( Writer, Features )
96  
97      /**
98       * Method write.
99       * 
100      * @param stream
101      * @param features
102      * @throws java.io.IOException
103      */
104     public void write( OutputStream stream, Features features )
105         throws java.io.IOException
106     {
107         Document document = new DocumentFactory().createDocument();
108         writeFeatures( features, "features-demo", document );
109         OutputFormat format = OutputFormat.createPrettyPrint();
110         format.setLineSeparator( System.getProperty( "line.separator" ) );
111         format.setEncoding( features.getModelEncoding() );
112         XMLWriter serializer = new XMLWriter( stream, format );
113         serializer.write( document );
114     } //-- void write( OutputStream, Features )
115 
116     /**
117      * Method writeAction.
118      * 
119      * @param action
120      * @param parentElement
121      * @param tagName
122      * @throws java.io.IOException
123      */
124     private void writeAction( Action action, String tagName, org.dom4j.Branch parentElement )
125         throws java.io.IOException
126     {
127         if ( action != null )
128         {
129             Element element = parentElement.addElement( tagName );
130             if ( action.getDev() != null )
131             {
132                 element.addAttribute( "dev", action.getDev() );
133             }
134             element.setText( action.getAction() );
135         }
136     } //-- void writeAction( Action, String, org.dom4j.Branch )
137 
138     /**
139      * Method writeAnnotationTest.
140      * 
141      * @param annotationTest
142      * @param parentElement
143      * @param tagName
144      * @throws java.io.IOException
145      */
146     private void writeAnnotationTest( AnnotationTest annotationTest, String tagName, org.dom4j.Branch parentElement )
147         throws java.io.IOException
148     {
149         if ( annotationTest != null )
150         {
151             Element element = parentElement.addElement( tagName );
152             if ( annotationTest.getAnyField() != null )
153             {
154                 element.addElement( "anyField" ).setText( annotationTest.getAnyField() );
155             }
156         }
157     } //-- void writeAnnotationTest( AnnotationTest, String, org.dom4j.Branch )
158 
159     /**
160      * Method writeArrayFeatures.
161      * 
162      * @param arrayFeatures
163      * @param parentElement
164      * @param tagName
165      * @throws java.io.IOException
166      */
167     private void writeArrayFeatures( ArrayFeatures arrayFeatures, String tagName, org.dom4j.Branch parentElement )
168         throws java.io.IOException
169     {
170         if ( arrayFeatures != null )
171         {
172             Element element = parentElement.addElement( tagName );
173         }
174     } //-- void writeArrayFeatures( ArrayFeatures, String, org.dom4j.Branch )
175 
176     /**
177      * Method writeAssociationFeatures.
178      * 
179      * @param associationFeatures
180      * @param parentElement
181      * @param tagName
182      * @throws java.io.IOException
183      */
184     private void writeAssociationFeatures( AssociationFeatures associationFeatures, String tagName, org.dom4j.Branch parentElement )
185         throws java.io.IOException
186     {
187         if ( associationFeatures != null )
188         {
189             Element element = parentElement.addElement( tagName );
190             if ( ( associationFeatures.getListReferences() != null ) && ( associationFeatures.getListReferences().size() > 0 ) )
191             {
192                 Element listElement = element;
193                 listElement = element.addElement( "listReferences" );
194                 for ( Iterator iter = associationFeatures.getListReferences().iterator(); iter.hasNext(); )
195                 {
196                     Reference o = (Reference) iter.next();
197                     writeReference( o, "listReference", listElement );
198                 }
199             }
200             if ( ( associationFeatures.getSetReferences() != null ) && ( associationFeatures.getSetReferences().size() > 0 ) )
201             {
202                 Element listElement = element;
203                 listElement = element.addElement( "setReferences" );
204                 for ( Iterator iter = associationFeatures.getSetReferences().iterator(); iter.hasNext(); )
205                 {
206                     Reference o = (Reference) iter.next();
207                     writeReference( o, "setReference", listElement );
208                 }
209             }
210             if ( ( associationFeatures.getListStrings() != null ) && ( associationFeatures.getListStrings().size() > 0 ) )
211             {
212                 Element listElement = element;
213                 listElement = element.addElement( "listStrings" );
214                 for ( Iterator iter = associationFeatures.getListStrings().iterator(); iter.hasNext(); )
215                 {
216                     String listString = (String) iter.next();
217                     listElement.addElement( "listString" ).setText( listString );
218                 }
219             }
220             if ( ( associationFeatures.getSetStrings() != null ) && ( associationFeatures.getSetStrings().size() > 0 ) )
221             {
222                 Element listElement = element;
223                 listElement = element.addElement( "setStrings" );
224                 for ( Iterator iter = associationFeatures.getSetStrings().iterator(); iter.hasNext(); )
225                 {
226                     String setString = (String) iter.next();
227                     listElement.addElement( "setString" ).setText( setString );
228                 }
229             }
230             if ( ( associationFeatures.getProperties() != null ) && ( associationFeatures.getProperties().size() > 0 ) )
231             {
232                 Element listElement = element;
233                 listElement = element.addElement( "properties" );
234                 for ( Iterator iter = associationFeatures.getProperties().keySet().iterator(); iter.hasNext(); )
235                 {
236                     String key = (String) iter.next();
237                     String value = (String) associationFeatures.getProperties().get( key );
238                     listElement.addElement( key ).setText( value );
239                 }
240             }
241             if ( associationFeatures.getBidi() != null )
242             {
243                 writeBidirectional( associationFeatures.getBidi(), "bidi", element );
244             }
245             if ( ( associationFeatures.getListOfBidis() != null ) && ( associationFeatures.getListOfBidis().size() > 0 ) )
246             {
247                 Element listElement = element;
248                 listElement = element.addElement( "listOfBidis" );
249                 for ( Iterator iter = associationFeatures.getListOfBidis().iterator(); iter.hasNext(); )
250                 {
251                     BidiInList o = (BidiInList) iter.next();
252                     writeBidiInList( o, "listOfBidi", listElement );
253                 }
254             }
255             if ( ( associationFeatures.getSetOfBidis() != null ) && ( associationFeatures.getSetOfBidis().size() > 0 ) )
256             {
257                 Element listElement = element;
258                 listElement = element.addElement( "setOfBidis" );
259                 for ( Iterator iter = associationFeatures.getSetOfBidis().iterator(); iter.hasNext(); )
260                 {
261                     BidiInSet o = (BidiInSet) iter.next();
262                     writeBidiInSet( o, "setOfBidi", listElement );
263                 }
264             }
265         }
266     } //-- void writeAssociationFeatures( AssociationFeatures, String, org.dom4j.Branch )
267 
268     /**
269      * Method writeBaseClass.
270      * 
271      * @param baseClass
272      * @param parentElement
273      * @param tagName
274      * @throws java.io.IOException
275      */
276     private void writeBaseClass( BaseClass baseClass, String tagName, org.dom4j.Branch parentElement )
277         throws java.io.IOException
278     {
279         if ( baseClass != null )
280         {
281             Element element = parentElement.addElement( tagName );
282             if ( baseClass.getBaseAttribute() != 0 )
283             {
284                 element.addAttribute( "baseAttribute", String.valueOf( baseClass.getBaseAttribute() ) );
285             }
286             if ( baseClass.getBaseElement() != 0 )
287             {
288                 element.addElement( "baseElement" ).setText( String.valueOf( baseClass.getBaseElement() ) );
289             }
290         }
291     } //-- void writeBaseClass( BaseClass, String, org.dom4j.Branch )
292 
293     /**
294      * Method writeBidiInList.
295      * 
296      * @param bidiInList
297      * @param parentElement
298      * @param tagName
299      * @throws java.io.IOException
300      */
301     private void writeBidiInList( BidiInList bidiInList, String tagName, org.dom4j.Branch parentElement )
302         throws java.io.IOException
303     {
304         if ( bidiInList != null )
305         {
306             Element element = parentElement.addElement( tagName );
307             if ( bidiInList.getParent() != null )
308             {
309                 writeAssociationFeatures( bidiInList.getParent(), "parent", element );
310             }
311         }
312     } //-- void writeBidiInList( BidiInList, String, org.dom4j.Branch )
313 
314     /**
315      * Method writeBidiInSet.
316      * 
317      * @param bidiInSet
318      * @param parentElement
319      * @param tagName
320      * @throws java.io.IOException
321      */
322     private void writeBidiInSet( BidiInSet bidiInSet, String tagName, org.dom4j.Branch parentElement )
323         throws java.io.IOException
324     {
325         if ( bidiInSet != null )
326         {
327             Element element = parentElement.addElement( tagName );
328             if ( bidiInSet.getParent() != null )
329             {
330                 writeAssociationFeatures( bidiInSet.getParent(), "parent", element );
331             }
332         }
333     } //-- void writeBidiInSet( BidiInSet, String, org.dom4j.Branch )
334 
335     /**
336      * Method writeBidirectional.
337      * 
338      * @param bidirectional
339      * @param parentElement
340      * @param tagName
341      * @throws java.io.IOException
342      */
343     private void writeBidirectional( Bidirectional bidirectional, String tagName, org.dom4j.Branch parentElement )
344         throws java.io.IOException
345     {
346         if ( bidirectional != null )
347         {
348             Element element = parentElement.addElement( tagName );
349             if ( bidirectional.getParent() != null )
350             {
351                 writeAssociationFeatures( bidirectional.getParent(), "parent", element );
352             }
353         }
354     } //-- void writeBidirectional( Bidirectional, String, org.dom4j.Branch )
355 
356     /**
357      * Method writeContentTest.
358      * 
359      * @param contentTest
360      * @param parentElement
361      * @param tagName
362      * @throws java.io.IOException
363      */
364     private void writeContentTest( ContentTest contentTest, String tagName, org.dom4j.Branch parentElement )
365         throws java.io.IOException
366     {
367         if ( contentTest != null )
368         {
369             Element element = parentElement.addElement( tagName );
370             if ( contentTest.getAttr() != null )
371             {
372                 element.addAttribute( "attr", contentTest.getAttr() );
373             }
374             if ( contentTest.getAttr2() != 0 )
375             {
376                 element.addAttribute( "attr2", String.valueOf( contentTest.getAttr2() ) );
377             }
378             element.setText( contentTest.getContent() );
379         }
380     } //-- void writeContentTest( ContentTest, String, org.dom4j.Branch )
381 
382     /**
383      * Method writeDueTo.
384      * 
385      * @param dueTo
386      * @param parentElement
387      * @param tagName
388      * @throws java.io.IOException
389      */
390     private void writeDueTo( DueTo dueTo, String tagName, org.dom4j.Branch parentElement )
391         throws java.io.IOException
392     {
393         if ( dueTo != null )
394         {
395             Element element = parentElement.addElement( tagName );
396             if ( dueTo.getName() != null )
397             {
398                 element.addAttribute( "name", dueTo.getName() );
399             }
400             if ( dueTo.getEmail() != null )
401             {
402                 element.addAttribute( "email", dueTo.getEmail() );
403             }
404         }
405     } //-- void writeDueTo( DueTo, String, org.dom4j.Branch )
406 
407     /**
408      * Method writeFeatures.
409      * 
410      * @param features
411      * @param parentElement
412      * @param tagName
413      * @throws java.io.IOException
414      */
415     private void writeFeatures( Features features, String tagName, org.dom4j.Branch parentElement )
416         throws java.io.IOException
417     {
418         if ( features != null )
419         {
420             Element element = parentElement.addElement( tagName, "http://codehaus-plexus.github.io/FEATURES/1.0.0" );
421             element.addAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
422             element.addAttribute( "xsi:schemaLocation", "http://codehaus-plexus.github.io/FEATURES/1.0.0 http://codehaus-plexus.github.io/features-1.0.0.xsd" );
423             if ( features.getVersionField() != null )
424             {
425                 element.addElement( "versionField" ).setText( features.getVersionField() );
426             }
427             if ( features.getComment() != null )
428             {
429                 element.addElement( "comment" ).setText( features.getComment() );
430             }
431             if ( features.getDescription() != null )
432             {
433                 element.addElement( "description" ).setText( features.getDescription() );
434             }
435             if ( features.getRequired() != null )
436             {
437                 element.addElement( "required" ).setText( features.getRequired() );
438             }
439             if ( features.getIdentifier() != null )
440             {
441                 element.addElement( "identifier" ).setText( features.getIdentifier() );
442             }
443             if ( features.getIdentifierPart2() != null )
444             {
445                 writeReference( features.getIdentifierPart2(), "identifierPart2", element );
446             }
447             if ( features.getSimpleTypes() != null )
448             {
449                 writeSimpleTypes( features.getSimpleTypes(), "simpleTypes", element );
450             }
451             if ( features.getDefaultValues() != null )
452             {
453                 writeSimpleTypes( features.getDefaultValues(), "defaultValues", element );
454             }
455             if ( features.getArrays() != null )
456             {
457                 writeArrayFeatures( features.getArrays(), "arrays", element );
458             }
459             if ( features.getAssociationFeatures() != null )
460             {
461                 writeAssociationFeatures( features.getAssociationFeatures(), "associationFeatures", element );
462             }
463             if ( features.getJavaFeatures() != null )
464             {
465                 writeJavaFeatures( features.getJavaFeatures(), "javaFeatures", element );
466             }
467             if ( features.getXmlFeatures() != null )
468             {
469                 writeXmlFeatures( features.getXmlFeatures(), "xmlFeatures", element );
470             }
471             if ( features.getXdocFeatures() != null )
472             {
473                 writeXdocFeatures( features.getXdocFeatures(), "xdocFeatures", element );
474             }
475             if ( features.getNode() != null )
476             {
477                 writeNodeItem( features.getNode(), "node", element );
478             }
479             if ( features.getCloneable() != null )
480             {
481                 writeThing( features.getCloneable(), "cloneable", element );
482             }
483             if ( features.getFile() != null )
484             {
485                 writeFile( features.getFile(), "file", element );
486             }
487             if ( features.getAction() != null )
488             {
489                 writeAction( features.getAction(), "action", element );
490             }
491         }
492     } //-- void writeFeatures( Features, String, org.dom4j.Branch )
493 
494     /**
495      * Method writeFile.
496      * 
497      * @param file
498      * @param parentElement
499      * @param tagName
500      * @throws java.io.IOException
501      */
502     private void writeFile( File file, String tagName, org.dom4j.Branch parentElement )
503         throws java.io.IOException
504     {
505         if ( file != null )
506         {
507             Element element = parentElement.addElement( tagName );
508             if ( file.getFile() != null )
509             {
510                 element.addElement( "file" ).setText( file.getFile() );
511             }
512         }
513     } //-- void writeFile( File, String, org.dom4j.Branch )
514 
515     /**
516      * Method writeInterfacesFeature.
517      * 
518      * @param interfacesFeature
519      * @param parentElement
520      * @param tagName
521      * @throws java.io.IOException
522      */
523     private void writeInterfacesFeature( InterfacesFeature interfacesFeature, String tagName, org.dom4j.Branch parentElement )
524         throws java.io.IOException
525     {
526         if ( interfacesFeature != null )
527         {
528             Element element = parentElement.addElement( tagName );
529             if ( interfacesFeature.getId() != null )
530             {
531                 element.addElement( "id" ).setText( interfacesFeature.getId() );
532             }
533         }
534     } //-- void writeInterfacesFeature( InterfacesFeature, String, org.dom4j.Branch )
535 
536     /**
537      * Method writeJavaFeatures.
538      * 
539      * @param javaFeatures
540      * @param parentElement
541      * @param tagName
542      * @throws java.io.IOException
543      */
544     private void writeJavaFeatures( JavaFeatures javaFeatures, String tagName, org.dom4j.Branch parentElement )
545         throws java.io.IOException
546     {
547         if ( javaFeatures != null )
548         {
549             Element element = parentElement.addElement( tagName );
550             if ( javaFeatures.getInterfaces() != null )
551             {
552                 writeInterfacesFeature( javaFeatures.getInterfaces(), "interfaces", element );
553             }
554             if ( javaFeatures.getPackageName() != null )
555             {
556                 writePackageNameFeature( javaFeatures.getPackageName(), "packageName", element );
557             }
558             if ( javaFeatures.getBase() != null )
559             {
560                 writeBaseClass( javaFeatures.getBase(), "base", element );
561             }
562             if ( javaFeatures.getSubClass() != null )
563             {
564                 writeSubClassLevel1( javaFeatures.getSubClass(), "subClass", element );
565             }
566             if ( javaFeatures.getSubClass2() != null )
567             {
568                 writeSubClassLevel2( javaFeatures.getSubClass2(), "subClass2", element );
569             }
570             if ( javaFeatures.getSubClass3() != null )
571             {
572                 writeSubClassLevel3( javaFeatures.getSubClass3(), "subClass3", element );
573             }
574             if ( javaFeatures.getAnnotation() != null )
575             {
576                 writeAnnotationTest( javaFeatures.getAnnotation(), "annotation", element );
577             }
578         }
579     } //-- void writeJavaFeatures( JavaFeatures, String, org.dom4j.Branch )
580 
581     /**
582      * Method writeNodeItem.
583      * 
584      * @param nodeItem
585      * @param parentElement
586      * @param tagName
587      * @throws java.io.IOException
588      */
589     private void writeNodeItem( NodeItem nodeItem, String tagName, org.dom4j.Branch parentElement )
590         throws java.io.IOException
591     {
592         if ( nodeItem != null )
593         {
594             Element element = parentElement.addElement( tagName );
595             if ( nodeItem.getValue() != null )
596             {
597                 element.addElement( "value" ).setText( nodeItem.getValue() );
598             }
599             if ( nodeItem.getChild() != null )
600             {
601                 writeNodeItem( nodeItem.getChild(), "child", element );
602             }
603         }
604     } //-- void writeNodeItem( NodeItem, String, org.dom4j.Branch )
605 
606     /**
607      * Method writePackageNameFeature.
608      * 
609      * @param packageNameFeature
610      * @param parentElement
611      * @param tagName
612      * @throws java.io.IOException
613      */
614     private void writePackageNameFeature( PackageNameFeature packageNameFeature, String tagName, org.dom4j.Branch parentElement )
615         throws java.io.IOException
616     {
617         if ( packageNameFeature != null )
618         {
619             Element element = parentElement.addElement( tagName );
620             if ( packageNameFeature.getReference() != null )
621             {
622                 writeReference( packageNameFeature.getReference(), "reference", element );
623             }
624         }
625     } //-- void writePackageNameFeature( PackageNameFeature, String, org.dom4j.Branch )
626 
627     /**
628      * Method writeReference.
629      * 
630      * @param reference
631      * @param parentElement
632      * @param tagName
633      * @throws java.io.IOException
634      */
635     private void writeReference( Reference reference, String tagName, org.dom4j.Branch parentElement )
636         throws java.io.IOException
637     {
638         if ( reference != null )
639         {
640             Element element = parentElement.addElement( tagName );
641             if ( reference.getId() != null )
642             {
643                 element.addElement( "id" ).setText( reference.getId() );
644             }
645         }
646     } //-- void writeReference( Reference, String, org.dom4j.Branch )
647 
648     /**
649      * Method writeSimpleTypes.
650      * 
651      * @param simpleTypes
652      * @param parentElement
653      * @param tagName
654      * @throws java.io.IOException
655      */
656     private void writeSimpleTypes( SimpleTypes simpleTypes, String tagName, org.dom4j.Branch parentElement )
657         throws java.io.IOException
658     {
659         if ( simpleTypes != null )
660         {
661             Element element = parentElement.addElement( tagName );
662             if ( simpleTypes.isPrimitiveBoolean() != true )
663             {
664                 element.addElement( "primitiveBoolean" ).setText( String.valueOf( simpleTypes.isPrimitiveBoolean() ) );
665             }
666             if ( simpleTypes.getPrimitiveChar() != 'H' )
667             {
668                 element.addElement( "primitiveChar" ).setText( String.valueOf( simpleTypes.getPrimitiveChar() ) );
669             }
670             if ( simpleTypes.getPrimitiveByte() != 12 )
671             {
672                 element.addElement( "primitiveByte" ).setText( String.valueOf( simpleTypes.getPrimitiveByte() ) );
673             }
674             if ( simpleTypes.getPrimitiveShort() != 1212 )
675             {
676                 element.addElement( "primitiveShort" ).setText( String.valueOf( simpleTypes.getPrimitiveShort() ) );
677             }
678             if ( simpleTypes.getPrimitiveInt() != 121212 )
679             {
680                 element.addElement( "primitiveInt" ).setText( String.valueOf( simpleTypes.getPrimitiveInt() ) );
681             }
682             if ( simpleTypes.getPrimitiveLong() != 1234567890123L )
683             {
684                 element.addElement( "primitiveLong" ).setText( String.valueOf( simpleTypes.getPrimitiveLong() ) );
685             }
686             if ( simpleTypes.getPrimitiveFloat() != 12.12f )
687             {
688                 element.addElement( "primitiveFloat" ).setText( String.valueOf( simpleTypes.getPrimitiveFloat() ) );
689             }
690             if ( simpleTypes.getPrimitiveDouble() != 12.12 )
691             {
692                 element.addElement( "primitiveDouble" ).setText( String.valueOf( simpleTypes.getPrimitiveDouble() ) );
693             }
694             if ( ( simpleTypes.getObjectString() != null ) && !simpleTypes.getObjectString().equals( "default value" ) )
695             {
696                 element.addElement( "objectString" ).setText( simpleTypes.getObjectString() );
697             }
698             if ( ( simpleTypes.getObjectDate() != null ) && !simpleTypes.getObjectDate().equals( new java.util.Date( 1356383532012L ) ) )
699             {
700                 element.addElement( "objectDate" ).setText( new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS", java.util.Locale.US ).format( simpleTypes.getObjectDate() ) );
701             }
702             if ( simpleTypes.isPrimitiveBooleanNoDefault() != false )
703             {
704                 element.addElement( "primitiveBooleanNoDefault" ).setText( String.valueOf( simpleTypes.isPrimitiveBooleanNoDefault() ) );
705             }
706             if ( simpleTypes.getPrimitiveCharNoDefault() != '\0' )
707             {
708                 element.addElement( "primitiveCharNoDefault" ).setText( String.valueOf( simpleTypes.getPrimitiveCharNoDefault() ) );
709             }
710             if ( simpleTypes.getPrimitiveByteNoDefault() != 0 )
711             {
712                 element.addElement( "primitiveByteNoDefault" ).setText( String.valueOf( simpleTypes.getPrimitiveByteNoDefault() ) );
713             }
714             if ( simpleTypes.getPrimitiveShortNoDefault() != 0 )
715             {
716                 element.addElement( "primitiveShortNoDefault" ).setText( String.valueOf( simpleTypes.getPrimitiveShortNoDefault() ) );
717             }
718             if ( simpleTypes.getPrimitiveIntNoDefault() != 0 )
719             {
720                 element.addElement( "primitiveIntNoDefault" ).setText( String.valueOf( simpleTypes.getPrimitiveIntNoDefault() ) );
721             }
722             if ( simpleTypes.getPrimitiveLongNoDefault() != 0L )
723             {
724                 element.addElement( "primitiveLongNoDefault" ).setText( String.valueOf( simpleTypes.getPrimitiveLongNoDefault() ) );
725             }
726             if ( simpleTypes.getPrimitiveFloatNoDefault() != 0.0f )
727             {
728                 element.addElement( "primitiveFloatNoDefault" ).setText( String.valueOf( simpleTypes.getPrimitiveFloatNoDefault() ) );
729             }
730             if ( simpleTypes.getPrimitiveDoubleNoDefault() != 0.0 )
731             {
732                 element.addElement( "primitiveDoubleNoDefault" ).setText( String.valueOf( simpleTypes.getPrimitiveDoubleNoDefault() ) );
733             }
734             if ( simpleTypes.getObjectStringNoDefault() != null )
735             {
736                 element.addElement( "objectStringNoDefault" ).setText( simpleTypes.getObjectStringNoDefault() );
737             }
738             if ( simpleTypes.getObjectDateNoDefault() != null )
739             {
740                 element.addElement( "objectDateNoDefault" ).setText( new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS", java.util.Locale.US ).format( simpleTypes.getObjectDateNoDefault() ) );
741             }
742             if ( simpleTypes.getDom() != null )
743             {
744                 writeXpp3DomToElement( (Xpp3Dom) simpleTypes.getDom(), element );
745             }
746             if ( simpleTypes.getContent() != null )
747             {
748                 writeContentTest( simpleTypes.getContent(), "content", element );
749             }
750         }
751     } //-- void writeSimpleTypes( SimpleTypes, String, org.dom4j.Branch )
752 
753     /**
754      * Method writeSubClassLevel1.
755      * 
756      * @param subClassLevel1
757      * @param parentElement
758      * @param tagName
759      * @throws java.io.IOException
760      */
761     private void writeSubClassLevel1( SubClassLevel1 subClassLevel1, String tagName, org.dom4j.Branch parentElement )
762         throws java.io.IOException
763     {
764         if ( subClassLevel1 != null )
765         {
766             Element element = parentElement.addElement( tagName );
767             if ( subClassLevel1.getSubAttribute1() != 0L )
768             {
769                 element.addAttribute( "subAttribute1", String.valueOf( subClassLevel1.getSubAttribute1() ) );
770             }
771             if ( subClassLevel1.getBaseAttribute() != 0 )
772             {
773                 element.addAttribute( "baseAttribute", String.valueOf( subClassLevel1.getBaseAttribute() ) );
774             }
775             if ( subClassLevel1.getSubElement1() != 0L )
776             {
777                 element.addElement( "subElement1" ).setText( String.valueOf( subClassLevel1.getSubElement1() ) );
778             }
779             if ( subClassLevel1.getBaseElement() != 0 )
780             {
781                 element.addElement( "baseElement" ).setText( String.valueOf( subClassLevel1.getBaseElement() ) );
782             }
783         }
784     } //-- void writeSubClassLevel1( SubClassLevel1, String, org.dom4j.Branch )
785 
786     /**
787      * Method writeSubClassLevel2.
788      * 
789      * @param subClassLevel2
790      * @param parentElement
791      * @param tagName
792      * @throws java.io.IOException
793      */
794     private void writeSubClassLevel2( SubClassLevel2 subClassLevel2, String tagName, org.dom4j.Branch parentElement )
795         throws java.io.IOException
796     {
797         if ( subClassLevel2 != null )
798         {
799             Element element = parentElement.addElement( tagName );
800             if ( subClassLevel2.getSubAttribute2() != 0.0f )
801             {
802                 element.addAttribute( "subAttribute2", String.valueOf( subClassLevel2.getSubAttribute2() ) );
803             }
804             if ( subClassLevel2.getSubAttribute1() != 0L )
805             {
806                 element.addAttribute( "subAttribute1", String.valueOf( subClassLevel2.getSubAttribute1() ) );
807             }
808             if ( subClassLevel2.getBaseAttribute() != 0 )
809             {
810                 element.addAttribute( "baseAttribute", String.valueOf( subClassLevel2.getBaseAttribute() ) );
811             }
812             if ( subClassLevel2.getSubElement2() != 0.0f )
813             {
814                 element.addElement( "subElement2" ).setText( String.valueOf( subClassLevel2.getSubElement2() ) );
815             }
816             if ( subClassLevel2.getSubElement1() != 0L )
817             {
818                 element.addElement( "subElement1" ).setText( String.valueOf( subClassLevel2.getSubElement1() ) );
819             }
820             if ( subClassLevel2.getBaseElement() != 0 )
821             {
822                 element.addElement( "baseElement" ).setText( String.valueOf( subClassLevel2.getBaseElement() ) );
823             }
824         }
825     } //-- void writeSubClassLevel2( SubClassLevel2, String, org.dom4j.Branch )
826 
827     /**
828      * Method writeSubClassLevel3.
829      * 
830      * @param subClassLevel3
831      * @param parentElement
832      * @param tagName
833      * @throws java.io.IOException
834      */
835     private void writeSubClassLevel3( SubClassLevel3 subClassLevel3, String tagName, org.dom4j.Branch parentElement )
836         throws java.io.IOException
837     {
838         if ( subClassLevel3 != null )
839         {
840             Element element = parentElement.addElement( tagName );
841             if ( subClassLevel3.getSubAttribute3() != 0.0 )
842             {
843                 element.addAttribute( "subAttribute3", String.valueOf( subClassLevel3.getSubAttribute3() ) );
844             }
845             if ( subClassLevel3.getSubAttribute2() != 0.0f )
846             {
847                 element.addAttribute( "subAttribute2", String.valueOf( subClassLevel3.getSubAttribute2() ) );
848             }
849             if ( subClassLevel3.getSubAttribute1() != 0L )
850             {
851                 element.addAttribute( "subAttribute1", String.valueOf( subClassLevel3.getSubAttribute1() ) );
852             }
853             if ( subClassLevel3.getBaseAttribute() != 0 )
854             {
855                 element.addAttribute( "baseAttribute", String.valueOf( subClassLevel3.getBaseAttribute() ) );
856             }
857             if ( subClassLevel3.getSubElement3() != 0.0 )
858             {
859                 element.addElement( "subElement3" ).setText( String.valueOf( subClassLevel3.getSubElement3() ) );
860             }
861             if ( subClassLevel3.getSubElement2() != 0.0f )
862             {
863                 element.addElement( "subElement2" ).setText( String.valueOf( subClassLevel3.getSubElement2() ) );
864             }
865             if ( subClassLevel3.getSubElement1() != 0L )
866             {
867                 element.addElement( "subElement1" ).setText( String.valueOf( subClassLevel3.getSubElement1() ) );
868             }
869             if ( subClassLevel3.getBaseElement() != 0 )
870             {
871                 element.addElement( "baseElement" ).setText( String.valueOf( subClassLevel3.getBaseElement() ) );
872             }
873         }
874     } //-- void writeSubClassLevel3( SubClassLevel3, String, org.dom4j.Branch )
875 
876     /**
877      * Method writeSuperThing.
878      * 
879      * @param superThing
880      * @param parentElement
881      * @param tagName
882      * @throws java.io.IOException
883      */
884     private void writeSuperThing( SuperThing superThing, String tagName, org.dom4j.Branch parentElement )
885         throws java.io.IOException
886     {
887         if ( superThing != null )
888         {
889             Element element = parentElement.addElement( tagName );
890         }
891     } //-- void writeSuperThing( SuperThing, String, org.dom4j.Branch )
892 
893     /**
894      * Method writeThing.
895      * 
896      * @param thing
897      * @param parentElement
898      * @param tagName
899      * @throws java.io.IOException
900      */
901     private void writeThing( Thing thing, String tagName, org.dom4j.Branch parentElement )
902         throws java.io.IOException
903     {
904         if ( thing != null )
905         {
906             Element element = parentElement.addElement( tagName );
907             if ( thing.isSomeBoolean() != false )
908             {
909                 element.addElement( "someBoolean" ).setText( String.valueOf( thing.isSomeBoolean() ) );
910             }
911             if ( thing.getSomeChar() != '\0' )
912             {
913                 element.addElement( "someChar" ).setText( String.valueOf( thing.getSomeChar() ) );
914             }
915             if ( thing.getSomeByte() != 0 )
916             {
917                 element.addElement( "someByte" ).setText( String.valueOf( thing.getSomeByte() ) );
918             }
919             if ( thing.getSomeShort() != 0 )
920             {
921                 element.addElement( "someShort" ).setText( String.valueOf( thing.getSomeShort() ) );
922             }
923             if ( thing.getSomeInt() != 0 )
924             {
925                 element.addElement( "someInt" ).setText( String.valueOf( thing.getSomeInt() ) );
926             }
927             if ( thing.getSomeLong() != 0L )
928             {
929                 element.addElement( "someLong" ).setText( String.valueOf( thing.getSomeLong() ) );
930             }
931             if ( thing.getSomeFloat() != 0.0f )
932             {
933                 element.addElement( "someFloat" ).setText( String.valueOf( thing.getSomeFloat() ) );
934             }
935             if ( thing.getSomeDouble() != 0.0 )
936             {
937                 element.addElement( "someDouble" ).setText( String.valueOf( thing.getSomeDouble() ) );
938             }
939             if ( thing.getSomeString() != null )
940             {
941                 element.addElement( "someString" ).setText( thing.getSomeString() );
942             }
943             if ( thing.getSomeDate() != null )
944             {
945                 element.addElement( "someDate" ).setText( new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS", java.util.Locale.US ).format( thing.getSomeDate() ) );
946             }
947             if ( thing.getSomeDom() != null )
948             {
949                 writeXpp3DomToElement( (Xpp3Dom) thing.getSomeDom(), element );
950             }
951             if ( ( thing.getSomeProperties() != null ) && ( thing.getSomeProperties().size() > 0 ) )
952             {
953                 Element listElement = element;
954                 listElement = element.addElement( "someProperties" );
955                 for ( Iterator iter = thing.getSomeProperties().keySet().iterator(); iter.hasNext(); )
956                 {
957                     String key = (String) iter.next();
958                     String value = (String) thing.getSomeProperties().get( key );
959                     listElement.addElement( key ).setText( value );
960                 }
961             }
962             if ( ( thing.getSomeStringList() != null ) && ( thing.getSomeStringList().size() > 0 ) )
963             {
964                 Element listElement = element;
965                 listElement = element.addElement( "someStringList" );
966                 for ( Iterator iter = thing.getSomeStringList().iterator(); iter.hasNext(); )
967                 {
968                     String someStringList = (String) iter.next();
969                     listElement.addElement( "someStringList" ).setText( someStringList );
970                 }
971             }
972             if ( ( thing.getSomeStringSet() != null ) && ( thing.getSomeStringSet().size() > 0 ) )
973             {
974                 Element listElement = element;
975                 listElement = element.addElement( "someStringSet" );
976                 for ( Iterator iter = thing.getSomeStringSet().iterator(); iter.hasNext(); )
977                 {
978                     String someStringSet = (String) iter.next();
979                     listElement.addElement( "someStringSet" ).setText( someStringSet );
980                 }
981             }
982             if ( thing.getDeepThingy() != null )
983             {
984                 writeThingy( thing.getDeepThingy(), "deepThingy", element );
985             }
986             if ( ( thing.getDeepThingyList() != null ) && ( thing.getDeepThingyList().size() > 0 ) )
987             {
988                 Element listElement = element;
989                 listElement = element.addElement( "deepThingyList" );
990                 for ( Iterator iter = thing.getDeepThingyList().iterator(); iter.hasNext(); )
991                 {
992                     Thingy o = (Thingy) iter.next();
993                     writeThingy( o, "deepThingyList", listElement );
994                 }
995             }
996             if ( ( thing.getDeepThingySet() != null ) && ( thing.getDeepThingySet().size() > 0 ) )
997             {
998                 Element listElement = element;
999                 listElement = element.addElement( "deepThingySet" );
1000                 for ( Iterator iter = thing.getDeepThingySet().iterator(); iter.hasNext(); )
1001                 {
1002                     Thingy o = (Thingy) iter.next();
1003                     writeThingy( o, "deepThingySet", listElement );
1004                 }
1005             }
1006             if ( thing.getShallowThingy() != null )
1007             {
1008                 writeThingy( thing.getShallowThingy(), "shallowThingy", element );
1009             }
1010             if ( ( thing.getShallowThingyList() != null ) && ( thing.getShallowThingyList().size() > 0 ) )
1011             {
1012                 Element listElement = element;
1013                 listElement = element.addElement( "shallowThingyList" );
1014                 for ( Iterator iter = thing.getShallowThingyList().iterator(); iter.hasNext(); )
1015                 {
1016                     Thingy o = (Thingy) iter.next();
1017                     writeThingy( o, "shallowThingyList", listElement );
1018                 }
1019             }
1020             if ( ( thing.getShallowThingySet() != null ) && ( thing.getShallowThingySet().size() > 0 ) )
1021             {
1022                 Element listElement = element;
1023                 listElement = element.addElement( "shallowThingySet" );
1024                 for ( Iterator iter = thing.getShallowThingySet().iterator(); iter.hasNext(); )
1025                 {
1026                     Thingy o = (Thingy) iter.next();
1027                     writeThingy( o, "shallowThingySet", listElement );
1028                 }
1029             }
1030         }
1031     } //-- void writeThing( Thing, String, org.dom4j.Branch )
1032 
1033     /**
1034      * Method writeThingy.
1035      * 
1036      * @param thingy
1037      * @param parentElement
1038      * @param tagName
1039      * @throws java.io.IOException
1040      */
1041     private void writeThingy( Thingy thingy, String tagName, org.dom4j.Branch parentElement )
1042         throws java.io.IOException
1043     {
1044         if ( thingy != null )
1045         {
1046             Element element = parentElement.addElement( tagName );
1047             element.setText( thingy.getSomeContent() );
1048         }
1049     } //-- void writeThingy( Thingy, String, org.dom4j.Branch )
1050 
1051     /**
1052      * Method writeXdocFeatures.
1053      * 
1054      * @param xdocFeatures
1055      * @param parentElement
1056      * @param tagName
1057      * @throws java.io.IOException
1058      */
1059     private void writeXdocFeatures( XdocFeatures xdocFeatures, String tagName, org.dom4j.Branch parentElement )
1060         throws java.io.IOException
1061     {
1062         if ( xdocFeatures != null )
1063         {
1064             Element element = parentElement.addElement( tagName );
1065             if ( xdocFeatures.getField() != null )
1066             {
1067                 element.addElement( "field" ).setText( xdocFeatures.getField() );
1068             }
1069             if ( xdocFeatures.getXdocSeparatorNone() != null )
1070             {
1071                 element.addElement( "xdocSeparatorNone" ).setText( xdocFeatures.getXdocSeparatorNone() );
1072             }
1073             if ( xdocFeatures.getXdocSeparatorBlank() != null )
1074             {
1075                 element.addElement( "xdocSeparatorBlank" ).setText( xdocFeatures.getXdocSeparatorBlank() );
1076             }
1077         }
1078     } //-- void writeXdocFeatures( XdocFeatures, String, org.dom4j.Branch )
1079 
1080     /**
1081      * Method writeXmlAttributes.
1082      * 
1083      * @param xmlAttributes
1084      * @param parentElement
1085      * @param tagName
1086      * @throws java.io.IOException
1087      */
1088     private void writeXmlAttributes( XmlAttributes xmlAttributes, String tagName, org.dom4j.Branch parentElement )
1089         throws java.io.IOException
1090     {
1091         if ( xmlAttributes != null )
1092         {
1093             Element element = parentElement.addElement( tagName );
1094             if ( xmlAttributes.isPrimitiveBoolean() != true )
1095             {
1096                 element.addAttribute( "primitiveBoolean", String.valueOf( xmlAttributes.isPrimitiveBoolean() ) );
1097             }
1098             if ( xmlAttributes.getPrimitiveChar() != 'H' )
1099             {
1100                 element.addAttribute( "primitiveChar", String.valueOf( xmlAttributes.getPrimitiveChar() ) );
1101             }
1102             if ( xmlAttributes.getPrimitiveByte() != 12 )
1103             {
1104                 element.addAttribute( "primitiveByte", String.valueOf( xmlAttributes.getPrimitiveByte() ) );
1105             }
1106             if ( xmlAttributes.getPrimitiveShort() != 1212 )
1107             {
1108                 element.addAttribute( "primitiveShort", String.valueOf( xmlAttributes.getPrimitiveShort() ) );
1109             }
1110             if ( xmlAttributes.getPrimitiveInt() != 121212 )
1111             {
1112                 element.addAttribute( "primitiveInt", String.valueOf( xmlAttributes.getPrimitiveInt() ) );
1113             }
1114             if ( xmlAttributes.getPrimitiveLong() != 1234567890123L )
1115             {
1116                 element.addAttribute( "primitiveLong", String.valueOf( xmlAttributes.getPrimitiveLong() ) );
1117             }
1118             if ( xmlAttributes.getPrimitiveFloat() != 12.12f )
1119             {
1120                 element.addAttribute( "primitiveFloat", String.valueOf( xmlAttributes.getPrimitiveFloat() ) );
1121             }
1122             if ( xmlAttributes.getPrimitiveDouble() != 12.12 )
1123             {
1124                 element.addAttribute( "primitiveDouble", String.valueOf( xmlAttributes.getPrimitiveDouble() ) );
1125             }
1126             if ( ( xmlAttributes.getObjectString() != null ) && !xmlAttributes.getObjectString().equals( "default value" ) )
1127             {
1128                 element.addAttribute( "objectString", xmlAttributes.getObjectString() );
1129             }
1130             if ( xmlAttributes.getObjectDate() != null )
1131             {
1132                 element.addAttribute( "objectDate", new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS", java.util.Locale.US ).format( xmlAttributes.getObjectDate() ) );
1133             }
1134             if ( ( xmlAttributes.getAttribute() != null ) && !xmlAttributes.getAttribute().equals( "default" ) )
1135             {
1136                 element.addAttribute( "tag-name", xmlAttributes.getAttribute() );
1137             }
1138         }
1139     } //-- void writeXmlAttributes( XmlAttributes, String, org.dom4j.Branch )
1140 
1141     /**
1142      * Method writeXmlContent.
1143      * 
1144      * @param xmlContent
1145      * @param parentElement
1146      * @param tagName
1147      * @throws java.io.IOException
1148      */
1149     private void writeXmlContent( XmlContent xmlContent, String tagName, org.dom4j.Branch parentElement )
1150         throws java.io.IOException
1151     {
1152         if ( xmlContent != null )
1153         {
1154             Element element = parentElement.addElement( tagName );
1155             if ( xmlContent.getLongContent() != null )
1156             {
1157                 writeXmlContentLong( xmlContent.getLongContent(), "content.long", element );
1158             }
1159             if ( xmlContent.getLongContentWithAttributes() != null )
1160             {
1161                 writeXmlContentLongWithAttributes( xmlContent.getLongContentWithAttributes(), "content.long-with-attributes", element );
1162             }
1163         }
1164     } //-- void writeXmlContent( XmlContent, String, org.dom4j.Branch )
1165 
1166     /**
1167      * Method writeXmlContentLong.
1168      * 
1169      * @param xmlContentLong
1170      * @param parentElement
1171      * @param tagName
1172      * @throws java.io.IOException
1173      */
1174     private void writeXmlContentLong( XmlContentLong xmlContentLong, String tagName, org.dom4j.Branch parentElement )
1175         throws java.io.IOException
1176     {
1177         if ( xmlContentLong != null )
1178         {
1179             Element element = parentElement.addElement( tagName );
1180             element.setText( String.valueOf( xmlContentLong.getContent() ) );
1181         }
1182     } //-- void writeXmlContentLong( XmlContentLong, String, org.dom4j.Branch )
1183 
1184     /**
1185      * Method writeXmlContentLongWithAttributes.
1186      * 
1187      * @param xmlContentLongWithAttributes
1188      * @param parentElement
1189      * @param tagName
1190      * @throws java.io.IOException
1191      */
1192     private void writeXmlContentLongWithAttributes( XmlContentLongWithAttributes xmlContentLongWithAttributes, String tagName, org.dom4j.Branch parentElement )
1193         throws java.io.IOException
1194     {
1195         if ( xmlContentLongWithAttributes != null )
1196         {
1197             Element element = parentElement.addElement( tagName );
1198             if ( xmlContentLongWithAttributes.getAttr() != null )
1199             {
1200                 element.addAttribute( "attr", xmlContentLongWithAttributes.getAttr() );
1201             }
1202             if ( xmlContentLongWithAttributes.getAttr2() != 0 )
1203             {
1204                 element.addAttribute( "attr2", String.valueOf( xmlContentLongWithAttributes.getAttr2() ) );
1205             }
1206             element.setText( String.valueOf( xmlContentLongWithAttributes.getContent() ) );
1207         }
1208     } //-- void writeXmlContentLongWithAttributes( XmlContentLongWithAttributes, String, org.dom4j.Branch )
1209 
1210     /**
1211      * Method writeXmlFeatures.
1212      * 
1213      * @param xmlFeatures
1214      * @param parentElement
1215      * @param tagName
1216      * @throws java.io.IOException
1217      */
1218     private void writeXmlFeatures( XmlFeatures xmlFeatures, String tagName, org.dom4j.Branch parentElement )
1219         throws java.io.IOException
1220     {
1221         if ( xmlFeatures != null )
1222         {
1223             Element element = parentElement.addElement( tagName );
1224             if ( xmlFeatures.getFieldNameAttribute() != null )
1225             {
1226                 element.addAttribute( "tag-name.attribute", xmlFeatures.getFieldNameAttribute() );
1227             }
1228             if ( xmlFeatures.getAttributes() != null )
1229             {
1230                 writeXmlAttributes( xmlFeatures.getAttributes(), "attributes", element );
1231             }
1232             if ( xmlFeatures.getAttributesDefault() != null )
1233             {
1234                 writeXmlAttributes( xmlFeatures.getAttributesDefault(), "attributesDefault", element );
1235             }
1236             if ( xmlFeatures.getContent() != null )
1237             {
1238                 writeXmlContent( xmlFeatures.getContent(), "content", element );
1239             }
1240             if ( xmlFeatures.getFieldTrim() != null )
1241             {
1242                 element.addElement( "fieldTrim" ).setText( xmlFeatures.getFieldTrim() );
1243             }
1244             if ( xmlFeatures.getFieldNoTrim() != null )
1245             {
1246                 element.addElement( "fieldNoTrim" ).setText( xmlFeatures.getFieldNoTrim() );
1247             }
1248             if ( xmlFeatures.getDom() != null )
1249             {
1250                 writeXpp3DomToElement( (Xpp3Dom) xmlFeatures.getDom(), element );
1251             }
1252             if ( xmlFeatures.getDomNoTrim() != null )
1253             {
1254                 writeXpp3DomToElement( (Xpp3Dom) xmlFeatures.getDomNoTrim(), element );
1255             }
1256             if ( xmlFeatures.getFieldName() != null )
1257             {
1258                 element.addElement( "tag-name" ).setText( xmlFeatures.getFieldName() );
1259             }
1260             if ( xmlFeatures.getDateXmlFormat() != null )
1261             {
1262                 element.addElement( "dateXmlFormat" ).setText( new java.text.SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss", java.util.Locale.US ).format( xmlFeatures.getDateXmlFormat() ) );
1263             }
1264             if ( xmlFeatures.getDateLong() != null )
1265             {
1266                 element.addElement( "dateLong" ).setText( String.valueOf( xmlFeatures.getDateLong().getTime() ) );
1267             }
1268             if ( ( xmlFeatures.getXmlItemsStyleFlats() != null ) && ( xmlFeatures.getXmlItemsStyleFlats().size() > 0 ) )
1269             {
1270                 Element listElement = element;
1271                 for ( Iterator iter = xmlFeatures.getXmlItemsStyleFlats().iterator(); iter.hasNext(); )
1272                 {
1273                     Reference o = (Reference) iter.next();
1274                     writeReference( o, "xmlItemsStyleFlat", listElement );
1275                 }
1276             }
1277             if ( ( xmlFeatures.getXmlAssociationTagNames() != null ) && ( xmlFeatures.getXmlAssociationTagNames().size() > 0 ) )
1278             {
1279                 Element listElement = element;
1280                 listElement = element.addElement( "xmlAssociationTagNames" );
1281                 for ( Iterator iter = xmlFeatures.getXmlAssociationTagNames().iterator(); iter.hasNext(); )
1282                 {
1283                     Reference o = (Reference) iter.next();
1284                     writeReference( o, "association.tag-name", listElement );
1285                 }
1286             }
1287             if ( ( xmlFeatures.getXmlTagNameAssociation() != null ) && ( xmlFeatures.getXmlTagNameAssociation().size() > 0 ) )
1288             {
1289                 Element listElement = element;
1290                 listElement = element.addElement( "field.tag-names" );
1291                 for ( Iterator iter = xmlFeatures.getXmlTagNameAssociation().iterator(); iter.hasNext(); )
1292                 {
1293                     Reference o = (Reference) iter.next();
1294                     writeReference( o, "field.tag-name", listElement );
1295                 }
1296             }
1297             if ( ( xmlFeatures.getXmlTagNameAssociationTagNames() != null ) && ( xmlFeatures.getXmlTagNameAssociationTagNames().size() > 0 ) )
1298             {
1299                 Element listElement = element;
1300                 listElement = element.addElement( "field.tag-name" );
1301                 for ( Iterator iter = xmlFeatures.getXmlTagNameAssociationTagNames().iterator(); iter.hasNext(); )
1302                 {
1303                     Reference o = (Reference) iter.next();
1304                     writeReference( o, "association.tag-name", listElement );
1305                 }
1306             }
1307             if ( ( xmlFeatures.getXmlFlatAssociationTagNames() != null ) && ( xmlFeatures.getXmlFlatAssociationTagNames().size() > 0 ) )
1308             {
1309                 Element listElement = element;
1310                 for ( Iterator iter = xmlFeatures.getXmlFlatAssociationTagNames().iterator(); iter.hasNext(); )
1311                 {
1312                     Reference o = (Reference) iter.next();
1313                     writeReference( o, "association.tag-name", listElement );
1314                 }
1315             }
1316             if ( ( xmlFeatures.getExplodeProperties() != null ) && ( xmlFeatures.getExplodeProperties().size() > 0 ) )
1317             {
1318                 Element listElement = element;
1319                 listElement = element.addElement( "explodeProperties" );
1320                 for ( Iterator iter = xmlFeatures.getExplodeProperties().keySet().iterator(); iter.hasNext(); )
1321                 {
1322                     String key = (String) iter.next();
1323                     String value = (String) xmlFeatures.getExplodeProperties().get( key );
1324                     Element assocElement = listElement.addElement( "explodeProperty" );
1325                     assocElement.addElement( "key" ).setText( key );
1326                     assocElement.addElement( "value" ).setText( value );
1327                 }
1328             }
1329             if ( ( xmlFeatures.getInlineProperties() != null ) && ( xmlFeatures.getInlineProperties().size() > 0 ) )
1330             {
1331                 Element listElement = element;
1332                 listElement = element.addElement( "inlineProperties" );
1333                 for ( Iterator iter = xmlFeatures.getInlineProperties().keySet().iterator(); iter.hasNext(); )
1334                 {
1335                     String key = (String) iter.next();
1336                     String value = (String) xmlFeatures.getInlineProperties().get( key );
1337                     listElement.addElement( key ).setText( value );
1338                 }
1339             }
1340             if ( xmlFeatures.getXmlTransientFields() != null )
1341             {
1342                 writeXmlTransientFields( xmlFeatures.getXmlTransientFields(), "xmlTransientFields", element );
1343             }
1344             if ( xmlFeatures.getXmlFieldsOrder() != null )
1345             {
1346                 writeXmlFieldsOrder( xmlFeatures.getXmlFieldsOrder(), "xmlFieldsOrder", element );
1347             }
1348             if ( xmlFeatures.getXsdFeatures() != null )
1349             {
1350                 writeXsdFeatures( xmlFeatures.getXsdFeatures(), "xsdFeatures", element );
1351             }
1352         }
1353     } //-- void writeXmlFeatures( XmlFeatures, String, org.dom4j.Branch )
1354 
1355     /**
1356      * Method writeXmlFieldsOrder.
1357      * 
1358      * @param xmlFieldsOrder
1359      * @param parentElement
1360      * @param tagName
1361      * @throws java.io.IOException
1362      */
1363     private void writeXmlFieldsOrder( XmlFieldsOrder xmlFieldsOrder, String tagName, org.dom4j.Branch parentElement )
1364         throws java.io.IOException
1365     {
1366         if ( xmlFieldsOrder != null )
1367         {
1368             Element element = parentElement.addElement( tagName );
1369             if ( xmlFieldsOrder.getField1() != null )
1370             {
1371                 element.addElement( "field1" ).setText( xmlFieldsOrder.getField1() );
1372             }
1373             if ( xmlFieldsOrder.getField() != null )
1374             {
1375                 element.addElement( "field-2" ).setText( xmlFieldsOrder.getField() );
1376             }
1377             if ( xmlFieldsOrder.getField3() != null )
1378             {
1379                 element.addElement( "field3" ).setText( xmlFieldsOrder.getField3() );
1380             }
1381             if ( xmlFieldsOrder.getField4() != null )
1382             {
1383                 element.addElement( "field4" ).setText( xmlFieldsOrder.getField4() );
1384             }
1385             if ( xmlFieldsOrder.getField5() != null )
1386             {
1387                 element.addElement( "field5" ).setText( xmlFieldsOrder.getField5() );
1388             }
1389             if ( xmlFieldsOrder.getField6() != null )
1390             {
1391                 element.addElement( "field6" ).setText( xmlFieldsOrder.getField6() );
1392             }
1393             if ( xmlFieldsOrder.getField7() != null )
1394             {
1395                 element.addElement( "field7" ).setText( xmlFieldsOrder.getField7() );
1396             }
1397         }
1398     } //-- void writeXmlFieldsOrder( XmlFieldsOrder, String, org.dom4j.Branch )
1399 
1400     /**
1401      * Method writeXmlFieldsOrderParent.
1402      * 
1403      * @param xmlFieldsOrderParent
1404      * @param parentElement
1405      * @param tagName
1406      * @throws java.io.IOException
1407      */
1408     private void writeXmlFieldsOrderParent( XmlFieldsOrderParent xmlFieldsOrderParent, String tagName, org.dom4j.Branch parentElement )
1409         throws java.io.IOException
1410     {
1411         if ( xmlFieldsOrderParent != null )
1412         {
1413             Element element = parentElement.addElement( tagName );
1414             if ( xmlFieldsOrderParent.getField() != null )
1415             {
1416                 element.addElement( "field-2" ).setText( xmlFieldsOrderParent.getField() );
1417             }
1418             if ( xmlFieldsOrderParent.getField4() != null )
1419             {
1420                 element.addElement( "field4" ).setText( xmlFieldsOrderParent.getField4() );
1421             }
1422             if ( xmlFieldsOrderParent.getField5() != null )
1423             {
1424                 element.addElement( "field5" ).setText( xmlFieldsOrderParent.getField5() );
1425             }
1426             if ( xmlFieldsOrderParent.getField7() != null )
1427             {
1428                 element.addElement( "field7" ).setText( xmlFieldsOrderParent.getField7() );
1429             }
1430         }
1431     } //-- void writeXmlFieldsOrderParent( XmlFieldsOrderParent, String, org.dom4j.Branch )
1432 
1433     /**
1434      * Method writeXmlFieldsOrderParent2.
1435      * 
1436      * @param xmlFieldsOrderParent2
1437      * @param parentElement
1438      * @param tagName
1439      * @throws java.io.IOException
1440      */
1441     private void writeXmlFieldsOrderParent2( XmlFieldsOrderParent2 xmlFieldsOrderParent2, String tagName, org.dom4j.Branch parentElement )
1442         throws java.io.IOException
1443     {
1444         if ( xmlFieldsOrderParent2 != null )
1445         {
1446             Element element = parentElement.addElement( tagName );
1447             if ( xmlFieldsOrderParent2.getField() != null )
1448             {
1449                 element.addElement( "field-2" ).setText( xmlFieldsOrderParent2.getField() );
1450             }
1451         }
1452     } //-- void writeXmlFieldsOrderParent2( XmlFieldsOrderParent2, String, org.dom4j.Branch )
1453 
1454     /**
1455      * Method writeXmlTransientFields.
1456      * 
1457      * @param xmlTransientFields
1458      * @param parentElement
1459      * @param tagName
1460      * @throws java.io.IOException
1461      */
1462     private void writeXmlTransientFields( XmlTransientFields xmlTransientFields, String tagName, org.dom4j.Branch parentElement )
1463         throws java.io.IOException
1464     {
1465         if ( xmlTransientFields != null )
1466         {
1467             Element element = parentElement.addElement( tagName );
1468             if ( xmlTransientFields.getPersistentField() != null )
1469             {
1470                 element.addElement( "persistentField" ).setText( xmlTransientFields.getPersistentField() );
1471             }
1472         }
1473     } //-- void writeXmlTransientFields( XmlTransientFields, String, org.dom4j.Branch )
1474 
1475     /**
1476      * Method writeXpp3DomToElement.
1477      * 
1478      * @param xpp3Dom
1479      * @param parentElement
1480      */
1481     private void writeXpp3DomToElement( Xpp3Dom xpp3Dom, Element parentElement )
1482     {
1483         Element element = parentElement.addElement( xpp3Dom.getName() );
1484         if ( xpp3Dom.getValue() != null )
1485         {
1486             element.setText( xpp3Dom.getValue() );
1487         }
1488         for ( Iterator i = Arrays.asList( xpp3Dom.getAttributeNames() ).iterator(); i.hasNext(); )
1489         {
1490             String name = (String) i.next();
1491             element.addAttribute( name, xpp3Dom.getAttribute( name ) );
1492         }
1493         for ( Iterator i = Arrays.asList( xpp3Dom.getChildren() ).iterator(); i.hasNext(); )
1494         {
1495             Xpp3Dom child = (Xpp3Dom) i.next();
1496             writeXpp3DomToElement( child, element );
1497         }
1498     } //-- void writeXpp3DomToElement( Xpp3Dom, Element )
1499 
1500     /**
1501      * Method writeXsdFeatures.
1502      * 
1503      * @param xsdFeatures
1504      * @param parentElement
1505      * @param tagName
1506      * @throws java.io.IOException
1507      */
1508     private void writeXsdFeatures( XsdFeatures xsdFeatures, String tagName, org.dom4j.Branch parentElement )
1509         throws java.io.IOException
1510     {
1511         if ( xsdFeatures != null )
1512         {
1513             Element element = parentElement.addElement( tagName );
1514             if ( xsdFeatures.getAttribute() != null )
1515             {
1516                 element.addAttribute( "attribute", xsdFeatures.getAttribute() );
1517             }
1518         }
1519     } //-- void writeXsdFeatures( XsdFeatures, String, org.dom4j.Branch )
1520 
1521 }