Package org.codehaus.modello.plugins.xml
Class AbstractXmlJavaGenerator
- java.lang.Object
-
- org.codehaus.modello.plugin.AbstractModelloGenerator
-
- org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator
-
- org.codehaus.modello.plugins.xml.AbstractXmlJavaGenerator
-
- All Implemented Interfaces:
org.codehaus.modello.plugin.ModelloGenerator
public abstract class AbstractXmlJavaGenerator extends org.codehaus.modello.plugin.java.AbstractJavaModelloGeneratorAbstract class for plugins generating Java code for XML representation of the model.- Author:
- Hervé Boutemy
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanstrictXmlAttributes
-
Constructor Summary
Constructors Constructor Description AbstractXmlJavaGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.codehaus.modello.model.ModelFieldgetContentField(java.util.List<org.codehaus.modello.model.ModelField> modelFields)Get the field which type isContentif 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.lang.StringgetFileName(java.lang.String suffix)protected java.lang.StringgetValue(java.lang.String type, java.lang.String initialValue, XmlFieldMetadata xmlFieldMetadata)protected voidinitialize(org.codehaus.modello.model.Model model, java.util.Map<java.lang.String,java.lang.Object> 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(org.codehaus.modello.model.ModelClass modelClass)Resolve XML tag name for a class.protected java.lang.StringresolveTagName(org.codehaus.modello.model.ModelField modelField, XmlFieldMetadata xmlFieldMetadata)Resolve XML tag name for a field.protected voidwriteDateParsingHelper(org.codehaus.modello.plugin.java.javasource.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, getBuildContext, getEncoding, getFieldsForClass, getGeneratedHeader, getGeneratedVersion, getHeader, getLicenseHeader, getLogger, getModel, getOutputDirectory, getParameter, isClassInModel, isCollection, isEmpty, isInnerAssociation, isMap, isPackageWithVersion, newWriter, newWriter, requireParameter, singular, uncapitalise
-
-
-
-
Method Detail
-
initialize
protected void initialize(org.codehaus.modello.model.Model model, java.util.Map<java.lang.String,java.lang.Object> parameters) throws org.codehaus.modello.ModelloException- Overrides:
initializein classorg.codehaus.modello.plugin.java.AbstractJavaModelloGenerator- Throws:
org.codehaus.modello.ModelloException
-
getFileName
protected java.lang.String getFileName(java.lang.String suffix)
-
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
-
getContentField
protected org.codehaus.modello.model.ModelField getContentField(java.util.List<org.codehaus.modello.model.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<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
-
getValue
protected java.lang.String getValue(java.lang.String type, java.lang.String initialValue, XmlFieldMetadata xmlFieldMetadata)
-
writeDateParsingHelper
protected void writeDateParsingHelper(org.codehaus.modello.plugin.java.javasource.JSourceCode sc, java.lang.String exception)
-
-