Class AbstractXmlJavaGenerator

java.lang.Object
org.codehaus.modello.plugin.AbstractModelloGenerator
org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator
org.codehaus.modello.plugins.xml.AbstractXmlJavaGenerator
All Implemented Interfaces:
org.codehaus.modello.plugin.ModelloGenerator

public abstract class AbstractXmlJavaGenerator extends org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator
Abstract class for plugins generating Java code for XML representation of the model.
Author:
Hervé Boutemy
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
     

    Fields inherited from class org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator

    DEFAULT_DATE_FORMAT, domAsXpp3
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.codehaus.modello.model.ModelField
    getContentField(List<org.codehaus.modello.model.ModelField> modelFields)
    Get the field which type is Content if any.
    protected List<org.codehaus.modello.model.ModelField>
    getFieldsForXml(org.codehaus.modello.model.ModelClass modelClass, org.codehaus.modello.model.Version version)
    Return the XML fields of this class, with proper XML order and no XML transient fields.
    protected String
     
    protected String
    getValue(String type, String initialValue, XmlFieldMetadata xmlFieldMetadata)
     
    protected void
    initialize(org.codehaus.modello.model.Model model, Properties parameters)
     
    protected String
    resolveTagName(String fieldTagName, XmlAssociationMetadata xmlAssociationMetadata)
    Resolve XML tag name for an item in an association with many multiplicity.
    protected String
    resolveTagName(org.codehaus.modello.model.ModelClass modelClass)
    Resolve XML tag name for a class.
    protected String
    resolveTagName(org.codehaus.modello.model.ModelField modelField, XmlFieldMetadata xmlFieldMetadata)
    Resolve XML tag name for a field.
    protected void
    writeDateParsingHelper(org.codehaus.modello.plugin.java.javasource.JSourceCode sc, String exception)
     

    Methods inherited from class org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator

    addModelImport, addModelImports, getClasses, getDefaultValue, getJavaDefaultValue, getPrefix, getValueChecker, hasJavaSourceSupport, initHeader, initHeader, isJavaEnabled, isRelevant, isTrackingSupport, newJSourceWriter, suppressAllWarnings

    Methods inherited from class org.codehaus.modello.plugin.AbstractModelloGenerator

    capitalise, getBuildContext, getEncoding, getFieldsForClass, getGeneratedVersion, getHeader, getLogger, getModel, getOutputDirectory, getParameter, getParameter, getParameter, isClassInModel, isCollection, isEmpty, isInnerAssociation, isMap, isPackageWithVersion, newWriter, newWriter, singular, uncapitalise

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.codehaus.modello.plugin.ModelloGenerator

    generate
  • Field Details

    • strictXmlAttributes

      protected boolean strictXmlAttributes
  • Constructor Details

    • AbstractXmlJavaGenerator

      public AbstractXmlJavaGenerator()
  • Method Details

    • initialize

      protected void initialize(org.codehaus.modello.model.Model model, Properties parameters) throws org.codehaus.modello.ModelloException
      Overrides:
      initialize in class org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator
      Throws:
      org.codehaus.modello.ModelloException
    • getFileName

      protected String getFileName(String suffix)
    • resolveTagName

      protected String resolveTagName(org.codehaus.modello.model.ModelClass modelClass)
      Resolve XML tag name for a class. Note: only root class needs such a resolution.
      Parameters:
      modelClass - the model class
      Returns:
      the XML tag name for the class
    • resolveTagName

      protected String resolveTagName(org.codehaus.modello.model.ModelField modelField, XmlFieldMetadata xmlFieldMetadata)
      Resolve XML tag name for a field.
      Parameters:
      modelField - the model field
      xmlFieldMetadata - the XML metadata of the field
      Returns:
      the XML tag name for the field
    • resolveTagName

      protected String resolveTagName(String fieldTagName, XmlAssociationMetadata xmlAssociationMetadata)
      Resolve XML tag name for an item in an association with many multiplicity.
      Parameters:
      fieldTagName - the XML tag name of the field containing the association
      xmlAssociationMetadata - the XML metadata of the association
      Returns:
      the XML tag name for items
    • getContentField

      protected org.codehaus.modello.model.ModelField getContentField(List<org.codehaus.modello.model.ModelField> modelFields)
      Get the field which type is Content if any.
      Parameters:
      modelFields - the fields to check
      Returns:
      the field, or null if no field is Content
    • getFieldsForXml

      protected List<org.codehaus.modello.model.ModelField> getFieldsForXml(org.codehaus.modello.model.ModelClass modelClass, org.codehaus.modello.model.Version version)
      Return the XML fields of this class, with proper XML order and no XML transient fields.
      Parameters:
      modelClass - current class
      version - the version of the class to use
      Returns:
      the list of XML fields of this class
    • getValue

      protected String getValue(String type, String initialValue, XmlFieldMetadata xmlFieldMetadata)
    • writeDateParsingHelper

      protected void writeDateParsingHelper(org.codehaus.modello.plugin.java.javasource.JSourceCode sc, String exception)