Package org.codehaus.modello.plugins.xml
Class AbstractXmlGenerator
- java.lang.Object
-
- org.codehaus.plexus.logging.AbstractLogEnabled
-
- org.codehaus.modello.plugin.AbstractModelloGenerator
-
- org.codehaus.modello.plugins.xml.AbstractXmlGenerator
-
- All Implemented Interfaces:
org.codehaus.modello.plugin.ModelloGenerator
,org.codehaus.plexus.logging.LogEnabled
,org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
public abstract class AbstractXmlGenerator extends org.codehaus.modello.plugin.AbstractModelloGenerator
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 Constructor Description AbstractXmlGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.codehaus.modello.model.ModelField
getContentField(java.util.List<org.codehaus.modello.model.ModelField> modelFields)
Get the field which type isContent
if any.protected java.util.List<org.codehaus.modello.model.ModelField>
getFieldsForXml(org.codehaus.modello.model.ModelClass modelClass, org.codehaus.modello.model.Version version)
Return the XML fields of this class, with proper XML order and no XML transient fields.protected java.util.List<org.codehaus.modello.model.ModelField>
getXmlAttributeFields(java.util.List<org.codehaus.modello.model.ModelField> modelFields)
Gets all fields that are not marked as XML attribute.protected boolean
hasContentField(java.util.List<org.codehaus.modello.model.ModelField> modelFields)
protected void
initHeader(org.codehaus.plexus.util.xml.XMLWriter w)
protected java.lang.String
resolveTagName(java.lang.String fieldTagName, XmlAssociationMetadata xmlAssociationMetadata)
Resolve XML tag name for an item in an association with many multiplicity.protected java.lang.String
resolveTagName(org.codehaus.modello.model.ModelClass modelClass)
Resolve XML tag name for a class.protected java.lang.String
resolveTagName(org.codehaus.modello.model.ModelField modelField, XmlFieldMetadata xmlFieldMetadata)
Resolve XML tag name for a field.-
Methods inherited from class org.codehaus.modello.plugin.AbstractModelloGenerator
capitalise, contextualize, getBuildContext, getEncoding, getFieldsForClass, getGeneratedVersion, getHeader, getModel, getOutputDirectory, getParameter, getParameter, getParameter, initialize, isClassInModel, isCollection, isEmpty, isInnerAssociation, isMap, isPackageWithVersion, newWriter, newWriter, singular, uncapitalise
-
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Method Detail
-
initHeader
protected void initHeader(org.codehaus.plexus.util.xml.XMLWriter w)
-
resolveTagName
protected java.lang.String resolveTagName(org.codehaus.modello.model.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(org.codehaus.modello.model.ModelField modelField, XmlFieldMetadata xmlFieldMetadata)
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
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 associationxmlAssociationMetadata
- the XML metadata of the association- Returns:
- the XML tag name for items
-
hasContentField
protected boolean hasContentField(java.util.List<org.codehaus.modello.model.ModelField> modelFields)
-
getContentField
protected org.codehaus.modello.model.ModelField getContentField(java.util.List<org.codehaus.modello.model.ModelField> modelFields)
Get the field which type isContent
if any.- Parameters:
modelFields
- the fields to check- Returns:
- the field, or
null
if no field isContent
-
getXmlAttributeFields
protected java.util.List<org.codehaus.modello.model.ModelField> getXmlAttributeFields(java.util.List<org.codehaus.modello.model.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 benull
.- Returns:
- The list of XML attributes fields, can be empty but never
null
.
-
getFieldsForXml
protected java.util.List<org.codehaus.modello.model.ModelField> getFieldsForXml(org.codehaus.modello.model.ModelClass modelClass, org.codehaus.modello.model.Version version)
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
-
-