Class XdocGenerator

  • All Implemented Interfaces:
    ModelloGenerator, org.codehaus.plexus.logging.LogEnabled, org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable

    public class XdocGenerator
    extends AbstractXmlGenerator
    • Field Detail

      • DEFAULT_VERSION_RANGE

        private static final VersionRange DEFAULT_VERSION_RANGE
      • firstVersion

        private Version firstVersion
    • Constructor Detail

      • XdocGenerator

        public XdocGenerator()
    • Method Detail

      • generateXdoc

        private void generateXdoc​(java.util.Properties parameters)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • getAnchorName

        private java.lang.String getAnchorName​(java.lang.String tagName)
        Get the anchor name by which model classes can be accessed in the generated xdoc/html file.
        Parameters:
        tagName - the name of the XML tag of the model class
        Returns:
        the corresponding anchor name
      • writeModelDescriptor

        private void writeModelDescriptor​(org.codehaus.plexus.util.xml.XMLWriter w,
                                          ModelClass rootModelClass)
        Write description of the whole model.
        Parameters:
        w - the output writer
        rootModelClass - the root class of the model
      • writeElementDescriptor

        private void writeElementDescriptor​(org.codehaus.plexus.util.xml.XMLWriter w,
                                            ModelClass modelClass,
                                            ModelAssociation association,
                                            java.util.Set<java.lang.String> written)
        Write description of an element of the XML representation of the model. This method is recursive.
        Parameters:
        w - the output writer
        modelClass - the mode class to describe
        association - the association we are coming from (can be null)
        written - set of data already written
      • getId

        private java.lang.String getId​(java.lang.String tagName,
                                       ModelClass modelClass)
      • writeFieldsTable

        private void writeFieldsTable​(org.codehaus.plexus.util.xml.XMLWriter w,
                                      java.util.List<ModelField> fields,
                                      boolean elementFields)
        Write a table containing model fields description.
        Parameters:
        w - the output writer
        fields - the fields to add in the table
        elementFields - true if fields are elements, false if fields are attributes
      • getModelXmlDescriptor

        private java.lang.String getModelXmlDescriptor​(ModelClass rootModelClass)
        Build the pretty tree describing the XML representation of the model.
        Parameters:
        rootModelClass - the model root class
        Returns:
        the String representing the tree model
      • getElementXmlDescriptor

        private java.lang.String getElementXmlDescriptor​(ModelClass modelClass,
                                                         ModelAssociation association,
                                                         java.util.Stack<java.lang.String> stack)
                                                  throws ModelloRuntimeException
        Build the pretty tree describing the XML representation of an element of the model. This method is recursive.
        Parameters:
        modelClass - the class we are printing the model
        association - the association we are coming from (can be null)
        stack - the stack of elements that have been traversed to come to the current one
        Returns:
        the String representing the tree model
        Throws:
        ModelloRuntimeException
      • resolveTagName

        private java.lang.String resolveTagName​(ModelClass modelClass,
                                                ModelAssociation association)
        Compute the tagName of a given class, living inside an association.
        Parameters:
        modelClass - the class we are looking for the tag name
        association - the association where this class is used
        Returns:
        the tag name to use
      • appendSpacer

        private static void appendSpacer​(java.lang.StringBuilder sb,
                                         int depth)
        Appends the required spacers to the given StringBuilder.
        Parameters:
        sb - where to append the spacers
        depth - the depth of spacers to generate
      • getDescription

        private static java.lang.String getDescription​(BaseElement element)
      • writeTextElement

        private static void writeTextElement​(org.codehaus.plexus.util.xml.XMLWriter w,
                                             java.lang.String name,
                                             java.lang.String text)
      • writeMarkupElement

        private static void writeMarkupElement​(org.codehaus.plexus.util.xml.XMLWriter w,
                                               java.lang.String name,
                                               java.lang.String markup)
      • rewrite

        private static java.lang.String rewrite​(java.lang.String text)
        Ensures that text will have balanced tags
        Parameters:
        text - xml or html based content
        Returns:
        valid XML string