Interface JavaDocRenderer

  • All Known Implementing Classes:
    DefaultJavaDocRenderer, NoAuthorJavaDocRenderer

    public interface JavaDocRenderer

    Specification for how to convert/render JavaDocData into an XML annotation. As an example, let us assume that a class contains the following field and JavaDoc:

         
             /**
             The last name of the SomewhatNamedPerson.
             */
             @XmlElement(nillable = false, required = true)
             private String lastName;
         
     

    The standard SchemaGen generation creates a complex type with the following element declaration:

         
             <xs:element name="lastName" type="xs:string" />
         
     

    However, if we use the jaxb2-maven-plugin for post-processing, we can inject the javadoc as an XSD annotation into the resulting schema, yielding the following result:

         
             <xs:element name="lastName" type="xs:string">
                 <xs:annotation>
                     <xs:documentation><![CDATA[The last name of the SomewhatNamedPerson.]]></xs:documentation>
                 </xs:annotation>
             </xs:element>
         
     

    The JavaDocRenderer will create the content of the CDATA element within the XSD documentation annotation, given the JavaDocData for each field, such as the lastName in our example.

    Since:
    2.0
    Author:
    Lennart Jörelid, jGuru Europe AB
    See Also:
    DefaultJavaDocRenderer
    • Method Detail

      • render

        String render​(JavaDocData nonNullData,
                      SortableLocation location)

        Renders the supplied JavaDocData structure as text to be used within an XSD documentation annotation. The XSD documentation annotation will contain a CDATA section to which the rendered JavaDocData is emitted.

        Parameters:
        nonNullData - the JavaDocData instance to render as XSD documentation. Will never be null.
        location - the SortableLocation where the JavaDocData was harvested. Never null.
        Returns:
        The rendered text contained within the XML annotation.