Class SnakeYamlReaderGenerator
java.lang.Object
org.codehaus.modello.plugin.AbstractModelloGenerator
org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator
org.codehaus.modello.plugins.xml.AbstractXmlJavaGenerator
org.codehaus.modello.plugin.snakeyaml.AbstractSnakeYamlGenerator
org.codehaus.modello.plugin.snakeyaml.SnakeYamlReaderGenerator
- All Implemented Interfaces:
ModelloGenerator
- Direct Known Subclasses:
SnakeYamlExtendedReaderGenerator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate Stringprivate ModelClassprivate static final Stringprivate ModelClassprivate StringFields 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 JMethodconvertNumericalType(String methodName, JType returnType, String expression, String typeDesc) voidprivate voidprotected booleanprivate 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 ModelFieldwriteClassAttributesParser(List<ModelField> modelFields, String objectName, boolean rootElement) 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, boolean wrappedItem) Write code to set a primitive field with a value got from the parser, with appropriate default value, trimming and required check logic.private voidwriteSetLocation(String key, String objectName, String trackerVariable, JSourceCode sc) Methods inherited from class org.codehaus.modello.plugins.xml.AbstractXmlJavaGenerator
getContentField, getFieldsForXml, getFileName, getValue, initialize, resolveTagName, resolveTagName, resolveTagName, writeDateParsingHelperMethods inherited from class org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator
addModelImport, addModelImports, getClasses, getDefaultValue, getJavaDefaultValue, getPrefix, getValueChecker, initHeader, initHeader, isJavaEnabled, isRelevant, isTrackingSupport, newJSourceWriter, suppressAllWarningsMethods inherited from class org.codehaus.modello.plugin.AbstractModelloGenerator
capitalise, getBuildContext, getEncoding, getFieldsForClass, getGeneratedHeader, getGeneratedVersion, getHeader, getLicenseHeader, getLogger, getModel, getOutputDirectory, getParameter, isClassInModel, isCollection, isEmpty, isInnerAssociation, isMap, isPackageWithVersion, newWriter, newWriter, requireParameter, singular, uncapitalise
-
Field Details
-
SOURCE_PARAM
- See Also:
-
LOCATION_VAR
- See Also:
-
locationTracker
-
locationField
-
sourceTracker
-
trackingArgs
-
-
Constructor Details
-
SnakeYamlReaderGenerator
public SnakeYamlReaderGenerator()
-
-
Method Details
-
isLocationTracking
protected boolean isLocationTracking() -
generate
- Throws:
ModelloException
-
writeAllClassesReaders
-
writeClassReaders
-
generateSnakeYamlReader
- Throws:
ModelloExceptionIOException
-
writeAllClassesParser
-
writeClassParser
-
writeClassAttributesParser
private ModelField writeClassAttributesParser(List<ModelField> modelFields, String objectName, boolean rootElement) -
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
-
writeHelpers
-
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
-
writeSetLocation
private void writeSetLocation(String key, String objectName, String trackerVariable, JSourceCode sc) -
writePrimitiveField
private void writePrimitiveField(ModelField field, String type, String objectName, String locatorName, String locationKey, String setterName, JSourceCode sc, boolean wrappedItem) Write code to set a primitive field with a value got from the parser, with appropriate default value, trimming and required check logic.- Parameters:
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 to
-
convertNumericalType
-