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 Stringprivate Stringprivate static final Stringprivate StringFields inherited from class org.codehaus.modello.plugin.xpp3.AbstractXpp3Generator
locationTracker, requiresDomSupport, sourceTrackerFields inherited from class org.codehaus.modello.plugins.xml.AbstractXmlJavaGenerator
strictXmlAttributesFields inherited from class org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator
DEFAULT_DATE_FORMAT, domAsXpp3 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddTrackingParameters(JMethod method) private StringbuildNewLocation(String source) private JMethodconvertNumericalType(String methodName, JType returnType, String expression, String typeDesc) voidgenerate(Model model, Properties parameters) private voidprivate JMethodprivate JMethodprivate JMethodprivate JMethodprivate JMethodprivate JMethodprivate JMethodprivate JMethodprivate JMethodprivate JMethodprivate JMethodprivate JMethodprotected voidinitialize(Model model, Properties parameters) private voidprocessField(ModelField field, XmlFieldMetadata xmlFieldMetadata, boolean addElse, JSourceCode sc, 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 voidprivate voidwriteBuildDomMethod(JClass jClass) private ModelFieldwriteClassAttributesParser(List<ModelField> modelFields, 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(String trackerVariable, JSourceCode sc) private voidwriteNewSetLocation(String key, String objectName, String trackerVariable, JSourceCode sc) private voidwriteNewSetLocation(ModelField field, String objectName, String trackerVariable, JSourceCode sc) private voidwritePrimitiveField(ModelField field, String type, String objectName, String locatorName, String locationKey, String setterName, JSourceCode sc) private voidwriteSetLocation(String key, String objectName, String trackerVariable, JSourceCode sc) Methods inherited from class org.codehaus.modello.plugin.xpp3.AbstractXpp3Generator
isLocationTrackingMethods inherited from class org.codehaus.modello.plugins.xml.AbstractXmlJavaGenerator
getContentField, getFieldsForXml, getFileName, getValue, resolveTagName, resolveTagName, resolveTagName, writeDateParsingHelperMethods inherited from class org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator
addModelImport, addModelImports, getClasses, getDefaultValue, getJavaDefaultValue, getPrefix, getValueChecker, hasJavaSourceSupport, initHeader, initHeader, isJavaEnabled, isRelevant, isTrackingSupport, newJSourceWriter, suppressAllWarningsMethods 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, uncapitaliseMethods 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:
initializein classAbstractXpp3Generator- Throws:
ModelloException
-
generate
- Throws:
ModelloException
-
writeAllClassesReaders
-
writeClassReaders
-
generateXpp3Reader
- Throws:
ModelloExceptionIOException
-
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 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, 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)
-