Class AbstractXmlGenerator

  • All Implemented Interfaces:
    ModelloGenerator, org.codehaus.plexus.logging.LogEnabled, org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
    Direct Known Subclasses:
    XdocGenerator, XsdGenerator

    public abstract class AbstractXmlGenerator
    extends AbstractModelloGenerator
    Abstract class for plugins working on XML representation of the model, without having any need to generate Java code.
    • Constructor Detail

      • AbstractXmlGenerator

        public AbstractXmlGenerator()
    • Method Detail

      • initHeader

        protected void initHeader​(org.codehaus.plexus.util.xml.XMLWriter w)
      • resolveTagName

        protected java.lang.String resolveTagName​(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 java.lang.String resolveTagName​(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 java.lang.String resolveTagName​(java.lang.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
      • hasContentField

        protected boolean hasContentField​(java.util.List<ModelField> modelFields)
      • getContentField

        protected ModelField getContentField​(java.util.List<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
      • getXmlAttributeFields

        protected java.util.List<ModelField> getXmlAttributeFields​(java.util.List<ModelField> modelFields)
        Gets all fields that are not marked as XML attribute.
        Parameters:
        modelFields - The collection of model fields from which to extract the XML attributes, must not be null.
        Returns:
        The list of XML attributes fields, can be empty but never null.
      • getFieldsForXml

        protected java.util.List<ModelField> getFieldsForXml​(ModelClass modelClass,
                                                             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