public class Xpp3ReaderGenerator extends AbstractXpp3Generator
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
LOCATION_VAR |
private java.lang.String |
locationField |
private ModelClass |
locationTracker |
private boolean |
requiresDomSupport |
private static java.lang.String |
SOURCE_PARAM |
private ModelClass |
sourceTracker |
private java.lang.String |
trackingArgs |
strictXmlAttributes
DEFAULT_DATE_FORMAT, domAsXpp3, useJava5
Constructor and Description |
---|
Xpp3ReaderGenerator() |
Modifier and Type | Method and Description |
---|---|
private void |
addTrackingParameters(JMethod method) |
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 boolean |
isLocationTracking() |
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 |
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(ModelField field,
java.lang.String objectName,
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 |
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) |
getContentField, getFieldsForXml, getFileName, getValue, initialize, resolveTagName, resolveTagName, resolveTagName, writeDateParsingHelper
addModelImports, getClasses, getDefaultValue, getJavaDefaultValue, getPrefix, getValueChecker, initHeader, initHeader, isJavaEnabled, isRelevant, isTrackingSupport, newJSourceWriter, suppressAllWarnings
capitalise, contextualize, getBuildContext, getEncoding, getFieldsForClass, getGeneratedVersion, getHeader, getModel, getOutputDirectory, getParameter, getParameter, getParameter, isClassInModel, isCollection, isEmpty, isInnerAssociation, isMap, isPackageWithVersion, singular, uncapitalise
private static final java.lang.String SOURCE_PARAM
private static final java.lang.String LOCATION_VAR
private ModelClass locationTracker
private java.lang.String locationField
private ModelClass sourceTracker
private java.lang.String trackingArgs
private boolean requiresDomSupport
protected boolean isLocationTracking()
public void generate(Model model, java.util.Properties parameters) throws ModelloException
ModelloException
private void writeClassReaders(ModelClass modelClass, JClass jClass, boolean rootElement)
private void generateXpp3Reader() throws ModelloException, java.io.IOException
ModelloException
java.io.IOException
private void writeClassParser(ModelClass modelClass, JClass jClass, boolean rootElement)
private ModelField writeClassAttributesParser(java.util.List<ModelField> modelFields, java.lang.String objectName, boolean rootElement, JSourceCode sc, JClass jClass)
private void processField(ModelField field, XmlFieldMetadata xmlFieldMetadata, boolean addElse, JSourceCode sc, java.lang.String objectName, JClass jClass)
field
- the field to processxmlFieldMetadata
- its XML metadataaddElse
- add an else
statement before generating a new if
sc
- the method source code to add toobjectName
- the object name in the sourcejClass
- the generated class source fileprivate 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 writeBuildDomMethod(JClass jClass)
private void writeHelpers(JClass jClass)
private JMethod getCheckUnknonwElement2Method()
private JMethod getNextTagMethod()
private JMethod getCheckUnknownAttributeMethod()
private JMethod getCheckFieldWithDuplicateMethod()
private JMethod getDateValue2Method()
private JMethod getDateValueMethod()
private JMethod getCharacterValueMethod()
private JMethod getBooleanValue2Method()
private JMethod getBooleanValueMethod()
private JMethod getRequiredAttributeValueMethod()
private JMethod getTrimmedValueMethod()
private JMethod getInterpolatedTrimmed()
private JMethod convertNumericalType(java.lang.String methodName, JType returnType, java.lang.String expression, java.lang.String typeDesc)
private void addTrackingParameters(JMethod method)
private void writeNewSetLocation(ModelField field, java.lang.String objectName, 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 writeNewLocation(java.lang.String trackerVariable, JSourceCode sc)
private void writeSetLocation(java.lang.String key, java.lang.String objectName, java.lang.String trackerVariable, JSourceCode sc)