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