Package org.codehaus.modello.plugin.java
Class AbstractJavaModelloGenerator
- java.lang.Object
-
- org.codehaus.plexus.logging.AbstractLogEnabled
-
- org.codehaus.modello.plugin.AbstractModelloGenerator
-
- org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator
-
- All Implemented Interfaces:
ModelloGenerator,org.codehaus.plexus.logging.LogEnabled,org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
- Direct Known Subclasses:
AbstractXmlJavaGenerator,ConverterGenerator,JavaModelloGenerator
public abstract class AbstractJavaModelloGenerator extends AbstractModelloGenerator
AbstractJavaModelloGenerator - similar in scope toAbstractModelloGeneratorbut with features that java generators can use.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringDEFAULT_DATE_FORMATprotected booleandomAsXpp3private java.util.Optional<java.lang.Integer>javaSource
-
Constructor Summary
Constructors Constructor Description AbstractJavaModelloGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddModelImport(JClass jClass, ModelType modelType, java.lang.String basePackageName)protected voidaddModelImports(JClass jClass, BaseElement baseElem)private java.lang.StringescapeStringLiteral(java.lang.String str)protected java.util.List<ModelClass>getClasses(Model model)protected java.lang.StringgetDefaultValue(ModelAssociation association)private JCommentgetHeaderComment()protected java.lang.StringgetJavaDefaultValue(ModelField modelField)protected java.lang.StringgetPrefix(JavaFieldMetadata javaFieldMetadata)protected java.lang.StringgetValueChecker(java.lang.String type, java.lang.String value, ModelField field)protected booleanhasJavaSourceSupport(int source)protected voidinitHeader(JClass clazz)protected voidinitHeader(JInterface interfaze)protected voidinitialize(Model model, java.util.Properties parameters)protected booleanisJavaEnabled(ModelClass modelClass)protected booleanisRelevant(ModelClass modelClass)protected booleanisTrackingSupport(ModelClass modelClass)protected JSourceWriternewJSourceWriter(java.lang.String packageName, java.lang.String className)Create a new java source file writer, with configured encoding.private java.lang.StringnewPrimitiveWrapper(java.lang.String type, java.lang.String value, boolean useJava5)protected voidsuppressAllWarnings(Model objectModel, JStructure structure)-
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, singular, uncapitalise
-
Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.codehaus.modello.plugin.ModelloGenerator
generate
-
-
-
-
Field Detail
-
javaSource
private java.util.Optional<java.lang.Integer> javaSource
-
domAsXpp3
protected boolean domAsXpp3
-
DEFAULT_DATE_FORMAT
protected static final java.lang.String DEFAULT_DATE_FORMAT
- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
protected void initialize(Model model, java.util.Properties parameters) throws ModelloException
- Overrides:
initializein classAbstractModelloGenerator- Throws:
ModelloException
-
newJSourceWriter
protected JSourceWriter newJSourceWriter(java.lang.String packageName, java.lang.String className) throws java.io.IOException
Create a new java source file writer, with configured encoding.- Parameters:
packageName- the package of the source file to createclassName- the class of the source file to create- Returns:
- a JSourceWriter with configured encoding
- Throws:
java.io.IOException
-
getHeaderComment
private JComment getHeaderComment()
-
initHeader
protected void initHeader(JClass clazz)
-
initHeader
protected void initHeader(JInterface interfaze)
-
hasJavaSourceSupport
protected final boolean hasJavaSourceSupport(int source)
-
suppressAllWarnings
protected void suppressAllWarnings(Model objectModel, JStructure structure)
-
addModelImports
protected void addModelImports(JClass jClass, BaseElement baseElem) throws ModelloException
- Throws:
ModelloException
-
addModelImport
protected void addModelImport(JClass jClass, ModelType modelType, java.lang.String basePackageName)
-
getPrefix
protected java.lang.String getPrefix(JavaFieldMetadata javaFieldMetadata)
-
getDefaultValue
protected java.lang.String getDefaultValue(ModelAssociation association)
-
getJavaDefaultValue
protected java.lang.String getJavaDefaultValue(ModelField modelField) throws ModelloException
- Throws:
ModelloException
-
newPrimitiveWrapper
private java.lang.String newPrimitiveWrapper(java.lang.String type, java.lang.String value, boolean useJava5)
-
escapeStringLiteral
private java.lang.String escapeStringLiteral(java.lang.String str)
-
getValueChecker
protected java.lang.String getValueChecker(java.lang.String type, java.lang.String value, ModelField field) throws ModelloException- Throws:
ModelloException
-
getClasses
protected java.util.List<ModelClass> getClasses(Model model)
-
isRelevant
protected boolean isRelevant(ModelClass modelClass)
-
isJavaEnabled
protected boolean isJavaEnabled(ModelClass modelClass)
-
isTrackingSupport
protected boolean isTrackingSupport(ModelClass modelClass)
-
-