Package org.codehaus.modello.plugins.xml
Class AbstractXmlJavaGenerator
- java.lang.Object
-
- org.codehaus.plexus.logging.AbstractLogEnabled
-
- org.codehaus.modello.plugin.AbstractModelloGenerator
-
- org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator
-
- org.codehaus.modello.plugins.xml.AbstractXmlJavaGenerator
-
- All Implemented Interfaces:
ModelloGenerator,org.codehaus.plexus.logging.LogEnabled,org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
- Direct Known Subclasses:
AbstractJDOMGenerator,AbstractStaxGenerator,AbstractXpp3Generator,Dom4jReaderGenerator,Dom4jWriterGenerator,SaxWriterGenerator
public abstract class AbstractXmlJavaGenerator extends AbstractJavaModelloGenerator
Abstract class for plugins generating Java code for XML representation of the model.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanstrictXmlAttributes-
Fields inherited from class org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator
DEFAULT_DATE_FORMAT, domAsXpp3, useJava5
-
-
Constructor Summary
Constructors Constructor Description AbstractXmlJavaGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ModelFieldgetContentField(java.util.List<ModelField> modelFields)Get the field which type isContentif any.protected java.util.List<ModelField>getFieldsForXml(ModelClass modelClass, Version version)Return the XML fields of this class, with proper XML order and no XML transient fields.protected java.lang.StringgetFileName(java.lang.String suffix)protected java.lang.StringgetValue(java.lang.String type, java.lang.String initialValue, XmlFieldMetadata xmlFieldMetadata)protected voidinitialize(Model model, java.util.Properties parameters)protected java.lang.StringresolveTagName(java.lang.String fieldTagName, XmlAssociationMetadata xmlAssociationMetadata)Resolve XML tag name for an item in an association with many multiplicity.protected java.lang.StringresolveTagName(ModelClass modelClass)Resolve XML tag name for a class.protected java.lang.StringresolveTagName(ModelField modelField, XmlFieldMetadata xmlFieldMetadata)Resolve XML tag name for a field.protected voidwriteDateParsingHelper(JSourceCode sc, java.lang.String exception)-
Methods inherited from class org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator
addModelImport, addModelImports, getClasses, getDefaultValue, getJavaDefaultValue, getPrefix, getValueChecker, initHeader, initHeader, isJavaEnabled, isRelevant, isTrackingSupport, newJSourceWriter, suppressAllWarnings
-
Methods inherited from class org.codehaus.modello.plugin.AbstractModelloGenerator
capitalise, contextualize, getBuildContext, getEncoding, getFieldsForClass, getGeneratedVersion, getHeader, getModel, getOutputDirectory, getParameter, getParameter, getParameter, isClassInModel, isCollection, isEmpty, isInnerAssociation, isMap, isPackageWithVersion, singular, uncapitalise
-
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.codehaus.modello.plugin.ModelloGenerator
generate
-
-
-
-
Method Detail
-
initialize
protected void initialize(Model model, java.util.Properties parameters) throws ModelloException
- Overrides:
initializein classAbstractJavaModelloGenerator- Throws:
ModelloException
-
getFileName
protected java.lang.String getFileName(java.lang.String suffix)
-
resolveTagName
protected java.lang.String resolveTagName(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(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
-
getContentField
protected ModelField getContentField(java.util.List<ModelField> modelFields)
Get the field which type isContentif any.- Parameters:
modelFields- the fields to check- Returns:
- the field, or
nullif no field isContent
-
getFieldsForXml
protected java.util.List<ModelField> getFieldsForXml(ModelClass modelClass, 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
-
getValue
protected java.lang.String getValue(java.lang.String type, java.lang.String initialValue, XmlFieldMetadata xmlFieldMetadata)
-
writeDateParsingHelper
protected void writeDateParsingHelper(JSourceCode sc, java.lang.String exception)
-
-