Package org.codehaus.modello.plugins.xml
Class AbstractXmlGenerator
java.lang.Object
org.codehaus.modello.plugin.AbstractModelloGenerator
org.codehaus.modello.plugins.xml.AbstractXmlGenerator
- All Implemented Interfaces:
ModelloGenerator
Abstract class for plugins working on XML representation of the model, without having any need to generate
Java code.
- Author:
- Hervé Boutemy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ModelFieldgetContentField(List<ModelField> modelFields) Get the field which type isContentif any.protected List<ModelField> getFieldsForXml(ModelClass modelClass, Version version) Return the XML fields of this class, with proper XML order and no XML transient fields.protected List<ModelField> getXmlAttributeFields(List<ModelField> modelFields) Gets all fields that are not marked as XML attribute.protected booleanhasContentField(List<ModelField> modelFields) protected voidinitHeader(org.codehaus.plexus.util.xml.XMLWriter w) protected StringresolveTagName(String fieldTagName, XmlAssociationMetadata xmlAssociationMetadata) Resolve XML tag name for an item in an association with many multiplicity.protected StringresolveTagName(ModelClass modelClass) Resolve XML tag name for a class.protected StringresolveTagName(ModelField modelField, XmlFieldMetadata xmlFieldMetadata) Resolve XML tag name for a field.Methods inherited from class org.codehaus.modello.plugin.AbstractModelloGenerator
capitalise, getBuildContext, getEncoding, getFieldsForClass, getGeneratedHeader, getGeneratedVersion, getHeader, getLicenseHeader, getLogger, getModel, getOutputDirectory, getParameter, initialize, isClassInModel, isCollection, isEmpty, isInnerAssociation, isMap, isPackageWithVersion, newWriter, newWriter, requireParameter, singular, uncapitaliseMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.codehaus.modello.plugin.ModelloGenerator
generate
-
Constructor Details
-
AbstractXmlGenerator
public AbstractXmlGenerator()
-
-
Method Details
-
initHeader
protected void initHeader(org.codehaus.plexus.util.xml.XMLWriter w) -
resolveTagName
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
Resolve XML tag name for a field.- Parameters:
modelField- the model fieldxmlFieldMetadata- the XML metadata of the field- Returns:
- the XML tag name for the field
-
resolveTagName
Resolve XML tag name for an item in an association with many multiplicity.- Parameters:
fieldTagName- the XML tag name of the field containing the associationxmlAssociationMetadata- the XML metadata of the association- Returns:
- the XML tag name for items
-
hasContentField
-
getContentField
Get the field which type isContentif any.- Parameters:
modelFields- the fields to check- Returns:
- the field, or
nullif no field isContent
-
getXmlAttributeFields
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 benull.- Returns:
- The list of XML attributes fields, can be empty but never
null.
-
getFieldsForXml
Return the XML fields of this class, with proper XML order and no XML transient fields.- Parameters:
modelClass- current classversion- the version of the class to use- Returns:
- the list of XML fields of this class
-