Package org.codehaus.modello.plugin.xpp3
Class Xpp3ReaderGenerator
- 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
-
- org.codehaus.modello.plugin.xpp3.AbstractXpp3Generator
-
- org.codehaus.modello.plugin.xpp3.Xpp3ReaderGenerator
-
- All Implemented Interfaces:
ModelloGenerator,org.codehaus.plexus.logging.LogEnabled,org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
- Direct Known Subclasses:
Xpp3ExtendedReaderGenerator
public class Xpp3ReaderGenerator extends AbstractXpp3Generator
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringLOCATION_VARprivate java.lang.StringlocationFieldprivate static java.lang.StringSOURCE_PARAMprivate java.lang.StringtrackingArgs-
Fields inherited from class org.codehaus.modello.plugin.xpp3.AbstractXpp3Generator
locationTracker, requiresDomSupport, sourceTracker
-
Fields inherited from class org.codehaus.modello.plugins.xml.AbstractXmlJavaGenerator
strictXmlAttributes
-
Fields inherited from class org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator
DEFAULT_DATE_FORMAT, domAsXpp3
-
-
Constructor Summary
Constructors Constructor Description Xpp3ReaderGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddTrackingParameters(JMethod method)private java.lang.StringbuildNewLocation(java.lang.String source)private JMethodconvertNumericalType(java.lang.String methodName, JType returnType, java.lang.String expression, java.lang.String typeDesc)voidgenerate(Model model, java.util.Properties parameters)private voidgenerateXpp3Reader()private JMethodgetBooleanValue2Method()private JMethodgetBooleanValueMethod()private JMethodgetCharacterValueMethod()private JMethodgetCheckFieldWithDuplicateMethod()private JMethodgetCheckUnknonwElement2Method()private JMethodgetCheckUnknownAttributeMethod()private JMethodgetDateValue2Method()private JMethodgetDateValueMethod()private JMethodgetInterpolatedTrimmed()private JMethodgetNextTagMethod()private JMethodgetRequiredAttributeValueMethod()private JMethodgetTrimmedValueMethod()protected voidinitialize(Model model, java.util.Properties parameters)private voidprocessField(ModelField field, XmlFieldMetadata xmlFieldMetadata, boolean addElse, JSourceCode sc, java.lang.String objectName, JClass jClass)Generate code to process a field represented as an XML element.private voidwriteAllClassesParser(Model objectModel, JClass jClass)private voidwriteAllClassesReaders(Model objectModel, JClass jClass)private voidwriteBuildDomLocationTrackingMethod(JClass jClass)private voidwriteBuildDomMethod(JClass jClass)private ModelFieldwriteClassAttributesParser(java.util.List<ModelField> modelFields, java.lang.String objectName, boolean rootElement, JSourceCode sc, JClass jClass)private voidwriteClassParser(ModelClass modelClass, JClass jClass, boolean rootElement)private voidwriteClassReaders(ModelClass modelClass, JClass jClass, boolean rootElement)private voidwriteHelpers(JClass jClass)private voidwriteNewLocation(java.lang.String trackerVariable, JSourceCode sc)private voidwriteNewSetLocation(java.lang.String key, java.lang.String objectName, java.lang.String trackerVariable, JSourceCode sc)private voidwriteNewSetLocation(ModelField field, java.lang.String objectName, java.lang.String trackerVariable, JSourceCode sc)private voidwritePrimitiveField(ModelField field, java.lang.String type, java.lang.String objectName, java.lang.String locatorName, java.lang.String locationKey, java.lang.String setterName, JSourceCode sc)private voidwriteSetLocation(java.lang.String key, java.lang.String objectName, java.lang.String trackerVariable, JSourceCode sc)-
Methods inherited from class org.codehaus.modello.plugin.xpp3.AbstractXpp3Generator
isLocationTracking
-
Methods inherited from class org.codehaus.modello.plugins.xml.AbstractXmlJavaGenerator
getContentField, getFieldsForXml, getFileName, getValue, resolveTagName, resolveTagName, resolveTagName, writeDateParsingHelper
-
Methods inherited from class org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator
addModelImport, addModelImports, getClasses, getDefaultValue, getJavaDefaultValue, getPrefix, getValueChecker, hasJavaSourceSupport, 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, newWriter, singular, uncapitalise
-
-
-
-
Field Detail
-
SOURCE_PARAM
private static final java.lang.String SOURCE_PARAM
- See Also:
- Constant Field Values
-
LOCATION_VAR
private static final java.lang.String LOCATION_VAR
- See Also:
- Constant Field Values
-
locationField
private java.lang.String locationField
-
trackingArgs
private java.lang.String trackingArgs
-
-
Method Detail
-
initialize
protected void initialize(Model model, java.util.Properties parameters) throws ModelloException
- Overrides:
initializein classAbstractXpp3Generator- Throws:
ModelloException
-
generate
public void generate(Model model, java.util.Properties parameters) throws ModelloException
- Throws:
ModelloException
-
writeClassReaders
private void writeClassReaders(ModelClass modelClass, JClass jClass, boolean rootElement)
-
generateXpp3Reader
private void generateXpp3Reader() throws ModelloException, java.io.IOException- Throws:
ModelloExceptionjava.io.IOException
-
writeClassParser
private void writeClassParser(ModelClass modelClass, JClass jClass, boolean rootElement)
-
writeClassAttributesParser
private ModelField writeClassAttributesParser(java.util.List<ModelField> modelFields, java.lang.String objectName, boolean rootElement, JSourceCode sc, JClass jClass)
-
processField
private void processField(ModelField field, XmlFieldMetadata xmlFieldMetadata, boolean addElse, JSourceCode sc, java.lang.String objectName, JClass jClass)
Generate code to process a field represented as an XML element.- Parameters:
field- the field to processxmlFieldMetadata- its XML metadataaddElse- add anelsestatement before generating a newifsc- the method source code to add toobjectName- the object name in the sourcejClass- the generated class source file
-
writePrimitiveField
private void writePrimitiveField(ModelField field, java.lang.String type, java.lang.String objectName, java.lang.String locatorName, java.lang.String locationKey, java.lang.String setterName, JSourceCode sc)
-
writeBuildDomMethod
private void writeBuildDomMethod(JClass jClass)
-
writeBuildDomLocationTrackingMethod
private void writeBuildDomLocationTrackingMethod(JClass jClass)
-
writeHelpers
private void writeHelpers(JClass jClass)
-
getCheckUnknonwElement2Method
private JMethod getCheckUnknonwElement2Method()
-
getNextTagMethod
private JMethod getNextTagMethod()
-
getCheckUnknownAttributeMethod
private JMethod getCheckUnknownAttributeMethod()
-
getCheckFieldWithDuplicateMethod
private JMethod getCheckFieldWithDuplicateMethod()
-
getDateValue2Method
private JMethod getDateValue2Method()
-
getDateValueMethod
private JMethod getDateValueMethod()
-
getCharacterValueMethod
private JMethod getCharacterValueMethod()
-
getBooleanValue2Method
private JMethod getBooleanValue2Method()
-
getBooleanValueMethod
private JMethod getBooleanValueMethod()
-
getRequiredAttributeValueMethod
private JMethod getRequiredAttributeValueMethod()
-
getTrimmedValueMethod
private JMethod getTrimmedValueMethod()
-
getInterpolatedTrimmed
private JMethod getInterpolatedTrimmed()
-
convertNumericalType
private JMethod convertNumericalType(java.lang.String methodName, JType returnType, java.lang.String expression, java.lang.String typeDesc)
-
addTrackingParameters
private void addTrackingParameters(JMethod method)
-
writeNewSetLocation
private void writeNewSetLocation(ModelField field, java.lang.String objectName, java.lang.String trackerVariable, JSourceCode sc)
-
writeNewSetLocation
private void writeNewSetLocation(java.lang.String key, java.lang.String objectName, java.lang.String trackerVariable, JSourceCode sc)
-
writeNewLocation
private void writeNewLocation(java.lang.String trackerVariable, JSourceCode sc)
-
buildNewLocation
private java.lang.String buildNewLocation(java.lang.String source)
-
writeSetLocation
private void writeSetLocation(java.lang.String key, java.lang.String objectName, java.lang.String trackerVariable, JSourceCode sc)
-
-