public class StaxReaderGenerator extends AbstractStaxGenerator
| Modifier and Type | Field and Description |
|---|---|
private boolean |
requiresDomSupport |
strictXmlAttributesDEFAULT_DATE_FORMAT, domAsXpp3, useJava5| Constructor and Description |
|---|
StaxReaderGenerator() |
| Modifier and Type | Method and Description |
|---|---|
private static void |
addCodeToAddReferences(ModelAssociation association,
JClass jClass,
JSourceCode sc,
ModelField referenceIdentifierField,
java.lang.String referredFromClass) |
private JMethod |
convertNumericalType(java.lang.String methodName,
JType returnType,
java.lang.String expression,
java.lang.String typeDesc) |
private GeneratorNode |
findRequiredReferenceResolvers(ModelClass modelClass,
GeneratorNode parent) |
void |
generate(Model model,
java.util.Properties parameters) |
private void |
generateStaxReader()
Generate a StAX reader, a
ModelNameStaxReader class in io.stax sub-package
with public RootClass read( ... |
private void |
generateStaxReaderDelegate(java.util.List<java.lang.String> versions) |
private static java.lang.String |
getInstanceFieldName(java.lang.String to) |
private static java.lang.String |
getRefFieldName(ModelAssociation association) |
private void |
processField(ModelField field,
XmlFieldMetadata xmlFieldMetadata,
boolean addElse,
JSourceCode sc,
java.lang.String objectName,
boolean rootElement,
JClass jClass)
Generate code to process a field represented as an XML element.
|
private void |
writeAllClassesParser(Model objectModel,
JClass jClass)
Write code to parse every classes from a model.
|
private void |
writeAttributes(ModelClass modelClass,
java.lang.String uncapClassName,
JSourceCode sc)
Add code to parse fields of a model class that are XML attributes.
|
private void |
writeBuildDomMethod(JClass jClass) |
private void |
writeClassParser(ModelClass modelClass,
JClass jClass,
boolean rootElement)
Write a
private ClassName parseClassName( ... |
private void |
writeDetermineVersionMethod(JClass jClass,
Model objectModel) |
private static void |
writeFieldVersionGetMethod(ModelField field,
JClass jClass) |
private void |
writeHelpers(JClass jClass) |
private void |
writeModelVersionCheck(JSourceCode sc) |
private static void |
writeModelVersionHack(JSourceCode sc) |
private static void |
writeNamespaceVersionGetMethod(java.lang.String namespace,
JClass jClass) |
private void |
writePrimitiveField(ModelField field,
java.lang.String type,
java.lang.String objectName,
java.lang.String setterName,
JSourceCode sc)
Write code to set a primitive field with a value got from the parser, with appropriate default value, trimming
and required check logic.
|
private void |
writeReferenceResolvers(GeneratorNode node,
JClass jClass) |
getReferenceIdentifierField, initialize, isAssociationPartToClassgetContentField, getFieldsForXml, getFileName, getValue, resolveTagName, resolveTagName, resolveTagName, writeDateParsingHelperaddModelImports, getClasses, getDefaultValue, getJavaDefaultValue, getPrefix, getValueChecker, initHeader, initHeader, isJavaEnabled, isRelevant, isTrackingSupport, newJSourceWriter, suppressAllWarningscapitalise, contextualize, getBuildContext, getEncoding, getFieldsForClass, getGeneratedVersion, getHeader, getModel, getOutputDirectory, getParameter, getParameter, getParameter, isClassInModel, isCollection, isEmpty, isInnerAssociation, isMap, isPackageWithVersion, singular, uncapitalisepublic void generate(Model model, java.util.Properties parameters) throws ModelloException
ModelloExceptionprivate void generateStaxReader()
throws ModelloException,
java.io.IOException
ModelNameStaxReader class in io.stax sub-package
with public RootClass read( ... ) methods.ModelloExceptionjava.io.IOExceptionprivate void generateStaxReaderDelegate(java.util.List<java.lang.String> versions)
throws ModelloException,
java.io.IOException
ModelloExceptionjava.io.IOExceptionprivate static void writeModelVersionHack(JSourceCode sc)
private void writeDetermineVersionMethod(JClass jClass, Model objectModel) throws ModelloException
ModelloExceptionprivate static void writeFieldVersionGetMethod(ModelField field, JClass jClass)
private static void writeNamespaceVersionGetMethod(java.lang.String namespace,
JClass jClass)
private void writeAllClassesParser(Model objectModel, JClass jClass) throws ModelloException
objectModel - the modeljClass - the generated class source fileModelloException#writeClassParser(ModelClass, JClass, boolean)}private void writeClassParser(ModelClass modelClass, JClass jClass, boolean rootElement) throws ModelloException
private ClassName parseClassName( ... ) method to parse a class from a model.modelClass - the model classjClass - the generated class source filerootElement - is this class the root from the model?ModelloExceptionprivate GeneratorNode findRequiredReferenceResolvers(ModelClass modelClass, GeneratorNode parent) throws ModelloException
ModelloExceptionprivate void writeReferenceResolvers(GeneratorNode node, JClass jClass)
private static java.lang.String getRefFieldName(ModelAssociation association)
private static java.lang.String getInstanceFieldName(java.lang.String to)
private void writeAttributes(ModelClass modelClass, java.lang.String uncapClassName, JSourceCode sc) throws ModelloException
modelClass - the model classuncapClassName - sc - the source code to add toModelloExceptionprivate void processField(ModelField field, XmlFieldMetadata xmlFieldMetadata, boolean addElse, JSourceCode sc, java.lang.String objectName, boolean rootElement, JClass jClass) throws ModelloException
field - the field to processxmlFieldMetadata - its XML metadataaddElse - add an else statement before generating a new ifsc - the method source code to add toobjectName - the object name in the sourcerootElement - is the enclosing model class the root class (for model version field handling)jClass - the generated class source fileModelloExceptionprivate static void addCodeToAddReferences(ModelAssociation association, JClass jClass, JSourceCode sc, ModelField referenceIdentifierField, java.lang.String referredFromClass)
private void writeModelVersionCheck(JSourceCode sc)
private void writePrimitiveField(ModelField field, java.lang.String type, java.lang.String objectName, java.lang.String setterName, JSourceCode sc)
field - the model field to set (either XML attribute or element)type - the type of the value read from XMLobjectName - the object name in sourcesetterName - the setter method namesc - the source code to add toprivate void writeBuildDomMethod(JClass jClass)
private void writeHelpers(JClass jClass)