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
@Component(role=ModelloGenerator.class,
hint="xpp3-reader")
public class Xpp3ReaderGenerator
extends AbstractXpp3Generator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private String
private static final String
private String
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 -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addTrackingParameters
(JMethod method) private String
buildNewLocation
(String source) private JMethod
convertNumericalType
(String methodName, JType returnType, String expression, String typeDesc) void
generate
(Model model, Properties parameters) private void
private JMethod
private JMethod
private JMethod
private JMethod
private JMethod
private JMethod
private JMethod
private JMethod
private JMethod
private JMethod
private JMethod
private JMethod
protected void
initialize
(Model model, Properties parameters) private void
processField
(ModelField field, XmlFieldMetadata xmlFieldMetadata, boolean addElse, JSourceCode sc, 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
private void
writeBuildDomMethod
(JClass jClass) private ModelField
writeClassAttributesParser
(List<ModelField> modelFields, 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
(String trackerVariable, JSourceCode sc) private void
writeNewSetLocation
(String key, String objectName, String trackerVariable, JSourceCode sc) private void
writeNewSetLocation
(ModelField field, String objectName, String trackerVariable, JSourceCode sc) private void
writePrimitiveField
(ModelField field, String type, String objectName, String locatorName, String locationKey, String setterName, JSourceCode sc) private void
writeSetLocation
(String key, String objectName, 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, newWriter, singular, uncapitalise
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
SOURCE_PARAM
- See Also:
-
LOCATION_VAR
- See Also:
-
locationField
-
trackingArgs
-
-
Constructor Details
-
Xpp3ReaderGenerator
public Xpp3ReaderGenerator()
-
-
Method Details
-
initialize
- Overrides:
initialize
in classAbstractXpp3Generator
- Throws:
ModelloException
-
generate
- Throws:
ModelloException
-
writeAllClassesReaders
-
writeClassReaders
-
generateXpp3Reader
- Throws:
ModelloException
IOException
-
writeAllClassesParser
-
writeClassParser
-
writeClassAttributesParser
private ModelField writeClassAttributesParser(List<ModelField> modelFields, String objectName, boolean rootElement, JSourceCode sc, JClass jClass) -
processField
private void processField(ModelField field, XmlFieldMetadata xmlFieldMetadata, boolean addElse, JSourceCode sc, 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, String type, String objectName, String locatorName, String locationKey, String setterName, JSourceCode sc) -
writeBuildDomMethod
-
writeBuildDomLocationTrackingMethod
-
writeHelpers
-
getCheckUnknonwElement2Method
-
getNextTagMethod
-
getCheckUnknownAttributeMethod
-
getCheckFieldWithDuplicateMethod
-
getDateValue2Method
-
getDateValueMethod
-
getCharacterValueMethod
-
getBooleanValue2Method
-
getBooleanValueMethod
-
getRequiredAttributeValueMethod
-
getTrimmedValueMethod
-
getInterpolatedTrimmed
-
convertNumericalType
-
addTrackingParameters
-
writeNewSetLocation
private void writeNewSetLocation(ModelField field, String objectName, String trackerVariable, JSourceCode sc) -
writeNewSetLocation
private void writeNewSetLocation(String key, String objectName, String trackerVariable, JSourceCode sc) -
writeNewLocation
-
buildNewLocation
-
writeSetLocation
private void writeSetLocation(String key, String objectName, String trackerVariable, JSourceCode sc)
-