Package org.codehaus.modello.plugin.java
Class JavaModelloGenerator
java.lang.Object
org.codehaus.plexus.logging.AbstractLogEnabled
org.codehaus.modello.plugin.AbstractModelloGenerator
org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator
org.codehaus.modello.plugin.java.JavaModelloGenerator
- All Implemented Interfaces:
ModelloGenerator,org.codehaus.plexus.logging.LogEnabled,org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
@Component(role=ModelloGenerator.class,
hint="java")
public class JavaModelloGenerator
extends AbstractJavaModelloGenerator
-
Field Summary
FieldsFields inherited from class org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator
DEFAULT_DATE_FORMAT, domAsXpp3 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddParameter(JMethodSignature jMethod, String type, String name, String comment) private voidappendEntryMethod(String type, String method, StringBuilder target, ModelAssociation modelAssociation) private StringappendPeriod(String string) Utility method that adds a period to the end of a string, if the last non-whitespace character of the string is not a punctuation mark or an end-tag.private voidcreateAdder(ModelAssociation modelAssociation, JClass jClass) private voidcreateAdder(ModelAssociation modelAssociation, JClass jClass, boolean isBuilderMethod) private voidcreateAssociation(JClass jClass, ModelAssociation modelAssociation, JSourceCode jConstructorSource) private voidcreateBreakAssociation(JClass jClass, ModelAssociation modelAssociation) private voidcreateBuilderAssociation(JClass jClass, ModelAssociation modelAssociation) private voidcreateBuilderField(JClass jClass, ModelField modelField) private voidcreateClassCastAssertion(JSourceCode sc, ModelAssociation modelAssociation, String crudModifier) private voidcreateCreateAssociation(JClass jClass, ModelAssociation modelAssociation) private JFieldcreateField(ModelField modelField) private voidcreateField(JClass jClass, ModelField modelField) private JMethodcreateGetter(JField field, ModelField modelField) private StringcreateHashCodeForField(ModelField identifier) private voidcreateInstanceAndSetProperties(ModelClass modelClass, JConstructor constructor, JSourceCode sc) private voidcreateSetBuilderAssociationToInstance(Set<String> ctorArgs, ModelAssociation modelAssociation, JSourceCode sc) private booleancreateSetBuilderFieldToInstance(Set<String> ctorArgs, ModelField modelField, JSourceCode sc) private JMethodcreateSetter(JField field, ModelField modelField) private JMethodcreateSetter(JField field, ModelField modelField, boolean isBuilderMethod) voidgenerate(Model model, Properties parameters) private voidgenerateBuilder(ModelClass modelClass, JClass builderClass, JConstructor outherClassConstructor) private JMethod[]generateClone(ModelClass modelClass, ModelClass locationClass) private JMethodgenerateEquals(ModelClass modelClass) private JMethodgenerateHashCode(ModelClass modelClass) private voidgenerateInterface(ModelInterface modelInterface) private voidprivate voidgenerateLocationBean(JClass jClass, ModelClass locationClass, ModelClass sourceClass) private StringgenerateLocationTracker(Model objectModel, ModelClass locationClass) private voidgenerateLocationTracking(JClass jClass, ModelClass modelClass, ModelClass locationClass) private voidgenerateStaticCreator(ModelClass modelClass, JClass jClass, JConstructor constructor) private JMethodgenerateToString(ModelClass modelClass, boolean onlyIdentifierFields) private StringgetCloneHook(ModelClass modelClass) private StringgetCloneMode(ModelAssociation modelAssociation, String cloneModeClass) private StringgetCloneMode(ModelClass modelClass) private JTypegetComponentType(ModelAssociation modelAssociation, JavaAssociationMetadata javaAssociationMetadata) private StringgetDefaultValue(ModelAssociation modelAssociation, JType componentType) private JTypegetDesiredType(ModelField modelField, boolean useTo) private JavaAssociationMetadatagetJavaAssociationMetadata(ModelAssociation modelAssociation) private booleanisBidirectionalAssociation(ModelAssociation association) Methods inherited from class org.codehaus.modello.plugin.java.AbstractJavaModelloGenerator
addModelImport, addModelImports, getClasses, getDefaultValue, getJavaDefaultValue, getPrefix, getValueChecker, hasJavaSourceSupport, initHeader, initHeader, initialize, 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
-
immutableTypes
-
-
Constructor Details
-
JavaModelloGenerator
public JavaModelloGenerator()
-
-
Method Details
-
generate
- Throws:
ModelloException
-
generateJava
- Throws:
ModelloExceptionIOException
-
generateInterface
- Throws:
ModelloExceptionIOException
-
generateEquals
-
generateToString
-
generateHashCode
-
generateClone
private JMethod[] generateClone(ModelClass modelClass, ModelClass locationClass) throws ModelloException - Throws:
ModelloException
-
getCloneMode
- Throws:
ModelloException
-
getCloneMode
private String getCloneMode(ModelAssociation modelAssociation, String cloneModeClass) throws ModelloException - Throws:
ModelloException
-
getCloneHook
- Throws:
ModelloException
-
generateLocationTracker
private String generateLocationTracker(Model objectModel, ModelClass locationClass) throws ModelloException, IOException - Throws:
ModelloExceptionIOException
-
generateLocationTracking
private void generateLocationTracking(JClass jClass, ModelClass modelClass, ModelClass locationClass) throws ModelloException - Throws:
ModelloException
-
generateLocationBean
private void generateLocationBean(JClass jClass, ModelClass locationClass, ModelClass sourceClass) throws ModelloException - Throws:
ModelloException
-
appendPeriod
Utility method that adds a period to the end of a string, if the last non-whitespace character of the string is not a punctuation mark or an end-tag.- Parameters:
string- The string to work with- Returns:
- The string that came in but with a period at the end
-
createHashCodeForField
-
createField
- Throws:
ModelloException
-
createField
- Throws:
ModelloException
-
createGetter
-
createSetter
- Throws:
ModelloException
-
createSetter
private JMethod createSetter(JField field, ModelField modelField, boolean isBuilderMethod) throws ModelloException - Throws:
ModelloException
-
createClassCastAssertion
private void createClassCastAssertion(JSourceCode sc, ModelAssociation modelAssociation, String crudModifier) throws ModelloException - Throws:
ModelloException
-
createAssociation
private void createAssociation(JClass jClass, ModelAssociation modelAssociation, JSourceCode jConstructorSource) throws ModelloException - Throws:
ModelloException
-
getDefaultValue
-
getJavaAssociationMetadata
private JavaAssociationMetadata getJavaAssociationMetadata(ModelAssociation modelAssociation) throws ModelloException - Throws:
ModelloException
-
getComponentType
private JType getComponentType(ModelAssociation modelAssociation, JavaAssociationMetadata javaAssociationMetadata) -
createCreateAssociation
-
createBreakAssociation
-
createAdder
- Throws:
ModelloException
-
createAdder
private void createAdder(ModelAssociation modelAssociation, JClass jClass, boolean isBuilderMethod) throws ModelloException - Throws:
ModelloException
-
isBidirectionalAssociation
-
getDesiredType
- Throws:
ModelloException
-
addParameter
-
generateBuilder
private void generateBuilder(ModelClass modelClass, JClass builderClass, JConstructor outherClassConstructor) throws ModelloException - Throws:
ModelloException
-
createInstanceAndSetProperties
private void createInstanceAndSetProperties(ModelClass modelClass, JConstructor constructor, JSourceCode sc) throws ModelloException - Throws:
ModelloException
-
createBuilderField
- Throws:
ModelloException
-
createSetBuilderFieldToInstance
private boolean createSetBuilderFieldToInstance(Set<String> ctorArgs, ModelField modelField, JSourceCode sc) throws ModelloException - Throws:
ModelloException
-
createBuilderAssociation
private void createBuilderAssociation(JClass jClass, ModelAssociation modelAssociation) throws ModelloException - Throws:
ModelloException
-
createSetBuilderAssociationToInstance
private void createSetBuilderAssociationToInstance(Set<String> ctorArgs, ModelAssociation modelAssociation, JSourceCode sc) throws ModelloException - Throws:
ModelloException
-
appendEntryMethod
private void appendEntryMethod(String type, String method, StringBuilder target, ModelAssociation modelAssociation) -
generateStaticCreator
private void generateStaticCreator(ModelClass modelClass, JClass jClass, JConstructor constructor) throws ModelloException - Throws:
ModelloException
-