public class XdocGenerator extends AbstractXmlGenerator
Modifier and Type | Field and Description |
---|---|
private static VersionRange |
DEFAULT_VERSION_RANGE |
private Version |
firstVersion |
private Version |
version |
Constructor and Description |
---|
XdocGenerator() |
Modifier and Type | Method and Description |
---|---|
private static void |
appendSpacer(java.lang.StringBuilder sb,
int depth)
Appends the required spacers to the given StringBuilder.
|
void |
generate(Model model,
java.util.Properties parameters) |
private void |
generateXdoc(java.util.Properties parameters) |
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.
|
private static java.lang.String |
getDescription(BaseElement element) |
private java.lang.String |
getElementXmlDescriptor(ModelClass modelClass,
ModelAssociation association,
java.util.Stack<java.lang.String> stack)
Build the pretty tree describing the XML representation of an element of the model.
|
private java.lang.String |
getId(java.lang.String tagName,
ModelClass modelClass) |
private java.lang.String |
getModelXmlDescriptor(ModelClass rootModelClass)
Build the pretty tree describing the XML representation of the model.
|
private java.lang.String |
resolveTagName(ModelClass modelClass,
ModelAssociation association)
Compute the tagName of a given class, living inside an association.
|
private static java.lang.String |
rewrite(java.lang.String text)
Ensures that text will have balanced tags
|
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.
|
private void |
writeFieldsTable(org.codehaus.plexus.util.xml.XMLWriter w,
java.util.List<ModelField> fields,
boolean elementFields)
Write a table containing model fields description.
|
private static void |
writeMarkupElement(org.codehaus.plexus.util.xml.XMLWriter w,
java.lang.String name,
java.lang.String markup) |
private void |
writeModelDescriptor(org.codehaus.plexus.util.xml.XMLWriter w,
ModelClass rootModelClass)
Write description of the whole model.
|
private static void |
writeTextElement(org.codehaus.plexus.util.xml.XMLWriter w,
java.lang.String name,
java.lang.String text) |
getContentField, getFieldsForXml, getXmlAttributeFields, hasContentField, initHeader, resolveTagName, resolveTagName, resolveTagName
capitalise, contextualize, getBuildContext, getEncoding, getFieldsForClass, getGeneratedVersion, getHeader, getModel, getOutputDirectory, getParameter, getParameter, getParameter, initialize, isClassInModel, isCollection, isEmpty, isInnerAssociation, isMap, isPackageWithVersion, singular, uncapitalise
private static final VersionRange DEFAULT_VERSION_RANGE
private Version firstVersion
private Version version
public void generate(Model model, java.util.Properties parameters) throws ModelloException
ModelloException
private void generateXdoc(java.util.Properties parameters) throws java.io.IOException
java.io.IOException
private java.lang.String getAnchorName(java.lang.String tagName)
tagName
- the name of the XML tag of the model classprivate void writeModelDescriptor(org.codehaus.plexus.util.xml.XMLWriter w, ModelClass rootModelClass)
w
- the output writerrootModelClass
- the root class of the modelprivate void writeElementDescriptor(org.codehaus.plexus.util.xml.XMLWriter w, ModelClass modelClass, ModelAssociation association, java.util.Set<java.lang.String> written)
w
- the output writermodelClass
- the mode class to describeassociation
- the association we are coming from (can be null
)written
- set of data already writtenprivate java.lang.String getId(java.lang.String tagName, ModelClass modelClass)
private void writeFieldsTable(org.codehaus.plexus.util.xml.XMLWriter w, java.util.List<ModelField> fields, boolean elementFields)
w
- the output writerfields
- the fields to add in the tableelementFields
- true
if fields are elements, false
if fields are attributesprivate java.lang.String getModelXmlDescriptor(ModelClass rootModelClass)
rootModelClass
- the model root classprivate java.lang.String getElementXmlDescriptor(ModelClass modelClass, ModelAssociation association, java.util.Stack<java.lang.String> stack) throws ModelloRuntimeException
modelClass
- the class we are printing the modelassociation
- the association we are coming from (can be null
)stack
- the stack of elements that have been traversed to come to the current oneModelloRuntimeException
private java.lang.String resolveTagName(ModelClass modelClass, ModelAssociation association)
modelClass
- the class we are looking for the tag nameassociation
- the association where this class is usedprivate static void appendSpacer(java.lang.StringBuilder sb, int depth)
sb
- where to append the spacersdepth
- the depth of spacers to generateprivate static java.lang.String getDescription(BaseElement element)
private static void writeTextElement(org.codehaus.plexus.util.xml.XMLWriter w, java.lang.String name, java.lang.String text)
private static void writeMarkupElement(org.codehaus.plexus.util.xml.XMLWriter w, java.lang.String name, java.lang.String markup)
private static java.lang.String rewrite(java.lang.String text)
text
- xml or html based content