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.String
LOCATION_VAR
private java.lang.String
locationField
private static java.lang.String
SOURCE_PARAM
private java.lang.String
trackingArgs
-
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, useJava5
-
-
Constructor Summary
Constructors Constructor Description Xpp3ReaderGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addTrackingParameters(JMethod method)
private java.lang.String
buildNewLocation(java.lang.String source)
private JMethod
convertNumericalType(java.lang.String methodName, JType returnType, java.lang.String expression, java.lang.String typeDesc)
void
generate(Model model, java.util.Properties parameters)
private void
generateXpp3Reader()
private JMethod
getBooleanValue2Method()
private JMethod
getBooleanValueMethod()
private JMethod
getCharacterValueMethod()
private JMethod
getCheckFieldWithDuplicateMethod()
private JMethod
getCheckUnknonwElement2Method()
private JMethod
getCheckUnknownAttributeMethod()
private JMethod
getDateValue2Method()
private JMethod
getDateValueMethod()
private JMethod
getInterpolatedTrimmed()
private JMethod
getNextTagMethod()
private JMethod
getRequiredAttributeValueMethod()
private JMethod
getTrimmedValueMethod()
protected void
initialize(Model model, java.util.Properties parameters)
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.private void
writeAllClassesParser(Model objectModel, JClass jClass)
private void
writeAllClassesReaders(Model objectModel, JClass jClass)
private void
writeBuildDomLocationTrackingMethod(JClass jClass)
private void
writeBuildDomMethod(JClass jClass)
private ModelField
writeClassAttributesParser(java.util.List<ModelField> modelFields, java.lang.String objectName, boolean rootElement, JSourceCode sc, JClass jClass)
private void
writeClassParser(ModelClass modelClass, JClass jClass, boolean rootElement)
private void
writeClassReaders(ModelClass modelClass, JClass jClass, boolean rootElement)
private void
writeHelpers(JClass jClass)
private void
writeNewLocation(java.lang.String trackerVariable, JSourceCode sc)
private void
writeNewSetLocation(java.lang.String key, java.lang.String objectName, java.lang.String trackerVariable, JSourceCode sc)
private void
writeNewSetLocation(ModelField field, java.lang.String objectName, java.lang.String trackerVariable, JSourceCode sc)
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)
private void
writeSetLocation(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, 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
-
-
-
-
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:
initialize
in 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:
ModelloException
java.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 anelse
statement before generating a newif
sc
- 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)
-
-