Class ObjectModelTransformerToJava
- java.lang.Object
-
- org.nuiton.eugene.Template<I>
-
- org.nuiton.eugene.Transformer<ObjectModel,O>
-
- org.nuiton.eugene.models.object.ObjectModelTransformer<ObjectModel>
-
- org.nuiton.eugene.java.ObjectModelTransformerToJava
-
- All Implemented Interfaces:
TemplateConfiguration
public abstract class ObjectModelTransformerToJava extends ObjectModelTransformer<ObjectModel>
Created: 28 oct. 2009- Author:
- Florian Desbois - desbois@codelutin.com
-
-
Field Summary
Fields Modifier and Type Field Description protected JavaBuilderbuilderinternal builderprotected EugeneCoreTagValueseugeneTagValues-
Fields inherited from class org.nuiton.eugene.Transformer
outputModel, outputProperties, outputTemplate, previousTransformer
-
Fields inherited from class org.nuiton.eugene.Template
configuration, excludeTemplates, generatedPackages, model, resourcesHelper
-
Fields inherited from interface org.nuiton.eugene.TemplateConfiguration
PROP_CLASS_LOADER, PROP_DEFAULT_PACKAGE, PROP_ENCODING, PROP_EXCLUDE_TEMPLATES, PROP_GENERATED_PACKAGES, PROP_I18N_GETTER_FILE, PROP_LAST_MODIFIED_SOURCE, PROP_OUTPUT_DIRECTORY, PROP_OVERWRITE, PROP_RESOURCE_DIRECTORY, PROP_VERBOSE, PROP_WRITER_REPORT
-
-
Constructor Summary
Constructors Constructor Description ObjectModelTransformerToJava()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ObjectModelAnnotationaddAnnotation(ObjectModelClassifier classifier, ObjectModelElement element, Class<?> annotationType)Add an annotation of the givenelementof the givenclassifier.ObjectModelAnnotationaddAnnotation(ObjectModelClassifier classifier, ObjectModelElement element, String annotationType)Add an annotation of the givenelementof the givenclassifier.ObjectModelAnnotationaddAnnotationParameter(ObjectModelClassifier classifier, ObjectModelAnnotation annotation, String annotationName, Object annotationValue)Add a parameter to an annotation.protected ObjectModelAttributeaddAttribute(ObjectModelClassifier classifier, String name, Class<?> type, String value, ObjectModelModifier... modifiers)ObjectModelAttributeaddAttribute(ObjectModelClassifier classifier, String name, String type)protected ObjectModelAttributeaddAttribute(ObjectModelClassifier classifier, String name, String type, String value, ObjectModelModifier... modifiers)protected ObjectModelAttributeaddAttribute(ObjectModelClassifier classifier, ObjectModelAttribute attribute)ObjectModelOperationaddBlock(ObjectModelClassifier classifier, ObjectModelModifier... modifiers)add an operation to the classifier with the form of a simple block of code.voidaddComment(ObjectModelElement element, String comment)Adds a comment to the givenelement.protected ObjectModelAttributeaddConstant(ObjectModelClassifier classifier, String name, Class<?> type, String value, ObjectModelModifier visibility)protected ObjectModelAttributeaddConstant(ObjectModelClassifier classifier, String name, String type, String value, ObjectModelModifier visibility)protected Set<String>addConstantsFromDependency(ObjectModelClassifier input, ObjectModelClassifier output)Search ininputmodel, for a enumeration dependency namedJavaGeneratorUtil.DEPENDENCIES_CONSTANTS.protected ObjectModelOperationaddConstructor(ObjectModelClass clazz, ObjectModelModifier visibility)protected ObjectModelOperationaddConstructor(ObjectModelEnumeration clazz, ObjectModelModifier visibility)protected voidaddException(ObjectModelOperation operation, Class<?> exception)protected voidaddException(ObjectModelOperation operation, String exception)protected voidaddGeneratedAnnotation(ObjectModelClassifier element)Add theGeneratedannotation to the givenObjectModelClassifierprotected voidaddI18n(StringBuilder buffer, String i18nPrefix, String suffix)protected voidaddImport(ObjectModelClassifier classifier, Class<?> imports)protected voidaddImport(ObjectModelClassifier classifier, String imports)protected voidaddImport(ObjectModelClassifier classifier, ObjectModelClass imports)ObjectModelClassifieraddInnerClassifier(ObjectModelClass clazz, ObjectModelType type, String name, ObjectModelModifier... modifiers)protected voidaddInterface(ObjectModelClassifier classifier, Class<?> interfaceQualifiedName)protected voidaddInterface(ObjectModelClassifier classifier, String interfaceQualifiedName)protected voidaddLiteral(ObjectModelEnumeration classifier, String name)protected ObjectModelOperationaddOperation(ObjectModelClassifier classifier, String name, Class<?> type, ObjectModelModifier... modifiers)protected ObjectModelOperationaddOperation(ObjectModelClassifier classifier, String name, String type, ObjectModelModifier... modifiers)protected ObjectModelOperationaddOperation(ObjectModelClassifier classifier, ObjectModelOperation operation)Adds an operation to the given classifier.protected ObjectModelParameteraddParameter(ObjectModelOperation operation, Class<?> type, String name)protected ObjectModelParameteraddParameter(ObjectModelOperation operation, String type, String name)voidaddStereotype(ObjectModelElement element, String stereotype)Add a stereotype to the givenelement.voidaddTagValue(String name, String value)Adds a tag value to the model.voidaddTagValue(ObjectModelElement element, String name, String value)Adds a tag value to the givenelement.protected ObjectModelAttributecloneAttribute(ObjectModelAttribute source, ObjectModelClassifier destination, boolean cloneDocumentation, ObjectModelModifier... modifiers)clone a given attribute into a classifier of the output modelObjectModelClasscloneClass(ObjectModelClass source, boolean cloneDocumentation)creates a clone of the givensourceclass in the output model and clones attributes, inheritence declarations and operations into the cloneObjectModelClassifiercloneClassifier(ObjectModelClassifier source, boolean cloneDocumentation)creates a clone of the givensourceclassifier in the output model and clones attributes, inheritence declaration and operationsprotected voidcloneClassifier(ObjectModelClassifier source, ObjectModelClassifier destination, boolean copyDocumentation)copy attributes, interfaces declartion and operation of a given classifier into another classifier.ObjectModelEnumerationcloneEnumeration(ObjectModelEnumeration source, boolean cloneDocumentation)creates a clone of the givensourceenumeration in the output model and clones attributes, inheritence declaration, operations and literals into the cloneObjectModelInterfacecloneInterface(ObjectModelInterface source, boolean cloneDocumentation)creates a clone of the givensourceinterface in the output model and clones attributes, inheritence declaration and operations into the cloneObjectModelOperationcloneOperation(ObjectModelOperation source, ObjectModelClassifier destination, boolean cloneDocumentation, ObjectModelJavaModifier... modifiers)Clone thesourceoperation into thedestinationclassifier.ObjectModelOperationcloneOperationSignature(ObjectModelOperation source, ObjectModelClassifier destination, boolean cloneDocumentation, ObjectModelModifier... modifiers)Clone thesourceoperation into thedestinationclassifier.protected voidcloneStereotypes(ObjectModelClassifier source, ObjectModelClassifier destination)protected voidcloneTagValues(ObjectModelElement source, ObjectModelElement destination)Copy all tag values fro the givensourceto the givendestination.protected voidcopyClassifier(ObjectModelClassifier source, ObjectModelClassifier destination, boolean copyDocumentation)Deprecated.since 2.3, prefer use thecloneClass(ObjectModelClass, boolean)methodprotected ObjectModelClasscreateAbstractClass(String name, String packageName)protected ObjectModelClasscreateClass(String name, String packageName)ObjectModelEnumerationcreateEnumeration(String name, String packageName)protected ObjectModelInterfacecreateInterface(String name, String packageName)protected voiddebugOutputModel()protected voidgenerateI18nBlock(ObjectModelClassifier input, ObjectModelClassifier output, String i18nPrefix)Generates a static block with I18n keys for each navigable attributes prefixed by the giveni18nPrefix.StringgetConstantName(String propertyName)StringgetConstantPrefix()protected StringgetConstantPrefix(ObjectModelClassifier input)protected URLgetFileInClassPath(String fqn)protected ImportsManagergetImportManager(ObjectModelClass clazz)protected StringgetJavaBeanMethodName(String methodPrefix, String propertyName)protected StringgetJavaBeanMethodName(String methodPrefix, String propertyName, String methodSuffix)protected StringgetMethodName(boolean useRelativeName, String[] relativeNameExcludes, String methodPrefix, String beanPackageName, String beanName)protected ObjectModelPackagegetPackage(String packageName)protected ObjectModelPackagegetPackage(ObjectModelClassifier input)protected StringimportAndSimplify(ObjectModelClassifier classifier, String imports)voidinitConstantPrefixFromModel()Used to initialize constant prefix depends on model tagvalueEugeneCoreTagValues.Store.constantPrefix.protected ObjectModelinitOutputModel()Initialization of the Output model.protected Template<ObjectModel>initOutputTemplate()Initialization of the Output generator.protected booleanisInClassPath(String fqn)Deprecated.since 3.0, use theTemplate.getResourcesHelper()object directly.protected booleanisInClassPath(String packageName, String className)Deprecated.since 3.0, use theTemplate.getResourcesHelper()object directly.protected booleanisInClassPath(ObjectModelClassifier classifier)Deprecated.since 3.0, use theTemplate.getResourcesHelper()object directly.voidsetConstantPrefix(String constantPrefix)voidsetDocumentation(ObjectModelElement element, String documentation)voidsetMaxMultiplicity(ObjectModelAttribute attribute, int multiplicity)Adds a max multiplicity to the givenattribute.voidsetMinMultiplicity(ObjectModelAttribute attribute, int multiplicity)Adds a min multiplicity to the givenattribute.voidsetNavigable(ObjectModelAttribute attribute, boolean navigable)Adds a navigable flag to the givenattribute.protected voidsetOperationBody(ObjectModelOperation operation, String body)protected voidsetSuperClass(ObjectModelClass classifier, Class<?> superclassQualifiedName)protected voidsetSuperClass(ObjectModelClass classifier, String superclassQualifiedName)protected voidstoreServiceLoaderFile(Class<?> type, List<? extends ObjectModelClassifier> classes, Function<? super ObjectModelClassifier,String> function)protected List<String>toQualifiedNames(List<? extends ObjectModelClassifier> classes, Function<? super ObjectModelClassifier,String> function)-
Methods inherited from class org.nuiton.eugene.models.object.ObjectModelTransformer
transform, transformFromClass, transformFromClassifier, transformFromElement, transformFromEnumeration, transformFromInterface, transformFromModel
-
Methods inherited from class org.nuiton.eugene.Transformer
addOutputProperty, applyTemplate, getDefaultPackageName, getOutputModel, getOutputProperties, getOutputTemplate, init, initPreviousTransformer, transform
-
Methods inherited from class org.nuiton.eugene.Template
getClassLoader, getConfiguration, getEncoding, getExcludeTemplates, getGeneratedPackages, getLastModifiedSource, getLog, getModel, getOverwrite, getProperties, getProperty, getProperty, getResourcesHelper, getWriterReport, isOverwrite, isVerbose, setConfiguration, setLog, setProperty
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuiton.eugene.TemplateConfiguration
getI18nGetterFile, setI18nGetterFile
-
-
-
-
Field Detail
-
builder
protected JavaBuilder builder
internal builder
-
eugeneTagValues
protected final EugeneCoreTagValues eugeneTagValues
-
-
Method Detail
-
initOutputTemplate
protected Template<ObjectModel> initOutputTemplate()
Description copied from class:TransformerInitialization of the Output generator. Must be override to instanciate the Generator that will make the generation of the Output model.- Specified by:
initOutputTemplatein classTransformer<ObjectModel,ObjectModel>- Returns:
- the output generator
-
initOutputModel
protected ObjectModel initOutputModel()
Description copied from class:TransformerInitialization of the Output model. Must be override to instanciate and initialize the output model. For ObjectModel you can use, ObjectModelBuilder to build easily an empty ObjectModel.- Specified by:
initOutputModelin classTransformer<ObjectModel,ObjectModel>- Returns:
- the output model
-
getImportManager
protected ImportsManager getImportManager(ObjectModelClass clazz)
-
debugOutputModel
protected void debugOutputModel()
- Specified by:
debugOutputModelin classObjectModelTransformer<ObjectModel>
-
addGeneratedAnnotation
protected void addGeneratedAnnotation(ObjectModelClassifier element)
Add theGeneratedannotation to the givenObjectModelClassifier- Parameters:
element- the element to be generated on which the annotation will be added- Since:
- 2.7
-
createClass
protected ObjectModelClass createClass(String name, String packageName)
-
getPackage
protected ObjectModelPackage getPackage(ObjectModelClassifier input)
-
getPackage
protected ObjectModelPackage getPackage(String packageName)
-
createEnumeration
public ObjectModelEnumeration createEnumeration(String name, String packageName)
-
createAbstractClass
protected ObjectModelClass createAbstractClass(String name, String packageName)
-
createInterface
protected ObjectModelInterface createInterface(String name, String packageName)
-
setSuperClass
protected void setSuperClass(ObjectModelClass classifier, String superclassQualifiedName)
-
setSuperClass
protected void setSuperClass(ObjectModelClass classifier, Class<?> superclassQualifiedName)
-
addInterface
protected void addInterface(ObjectModelClassifier classifier, String interfaceQualifiedName)
-
addInterface
protected void addInterface(ObjectModelClassifier classifier, Class<?> interfaceQualifiedName)
-
addImport
protected void addImport(ObjectModelClassifier classifier, String imports)
-
addImport
protected void addImport(ObjectModelClassifier classifier, ObjectModelClass imports)
-
addImport
protected void addImport(ObjectModelClassifier classifier, Class<?> imports)
-
importAndSimplify
protected String importAndSimplify(ObjectModelClassifier classifier, String imports)
-
addTagValue
public void addTagValue(String name, String value)
Adds a tag value to the model.- Parameters:
name- name of the tag valuevalue- value of the tag value
-
addTagValue
public void addTagValue(ObjectModelElement element, String name, String value)
Adds a tag value to the givenelement.- Parameters:
element- the element on which the tag value is attached.name- the name of the tag valuevalue- the value of the tag value
-
getConstantPrefix
protected String getConstantPrefix(ObjectModelClassifier input)
-
addConstant
protected ObjectModelAttribute addConstant(ObjectModelClassifier classifier, String name, String type, String value, ObjectModelModifier visibility) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
addConstant
protected ObjectModelAttribute addConstant(ObjectModelClassifier classifier, String name, Class<?> type, String value, ObjectModelModifier visibility) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
addAttribute
protected ObjectModelAttribute addAttribute(ObjectModelClassifier classifier, String name, String type, String value, ObjectModelModifier... modifiers)
-
addAttribute
protected ObjectModelAttribute addAttribute(ObjectModelClassifier classifier, String name, Class<?> type, String value, ObjectModelModifier... modifiers)
-
addAttribute
protected ObjectModelAttribute addAttribute(ObjectModelClassifier classifier, ObjectModelAttribute attribute)
-
addAttribute
public ObjectModelAttribute addAttribute(ObjectModelClassifier classifier, String name, String type)
-
addConstructor
protected ObjectModelOperation addConstructor(ObjectModelClass clazz, ObjectModelModifier visibility) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
addConstructor
protected ObjectModelOperation addConstructor(ObjectModelEnumeration clazz, ObjectModelModifier visibility) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
addOperation
protected ObjectModelOperation addOperation(ObjectModelClassifier classifier, String name, String type, ObjectModelModifier... modifiers)
-
addOperation
protected ObjectModelOperation addOperation(ObjectModelClassifier classifier, String name, Class<?> type, ObjectModelModifier... modifiers)
-
addOperation
protected ObjectModelOperation addOperation(ObjectModelClassifier classifier, ObjectModelOperation operation)
Adds an operation to the given classifier.- Parameters:
classifier- the classifier on which the operation will be addedoperation- the operation to add- Returns:
- the added operation
- Since:
- 2.1.2
-
addLiteral
protected void addLiteral(ObjectModelEnumeration classifier, String name)
-
addParameter
protected ObjectModelParameter addParameter(ObjectModelOperation operation, String type, String name)
-
addParameter
protected ObjectModelParameter addParameter(ObjectModelOperation operation, Class<?> type, String name)
-
addException
protected void addException(ObjectModelOperation operation, String exception)
-
addException
protected void addException(ObjectModelOperation operation, Class<?> exception)
-
setOperationBody
protected void setOperationBody(ObjectModelOperation operation, String body) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
addInnerClassifier
public ObjectModelClassifier addInnerClassifier(ObjectModelClass clazz, ObjectModelType type, String name, ObjectModelModifier... modifiers) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
setDocumentation
public void setDocumentation(ObjectModelElement element, String documentation)
-
setMinMultiplicity
public void setMinMultiplicity(ObjectModelAttribute attribute, int multiplicity)
Adds a min multiplicity to the givenattribute.- Parameters:
attribute- the attribute on which the min multiplicty will be settedmultiplicity- the multiplicity to set- Since:
- 2.1.2
-
setMaxMultiplicity
public void setMaxMultiplicity(ObjectModelAttribute attribute, int multiplicity)
Adds a max multiplicity to the givenattribute.- Parameters:
attribute- the attribute on which the min multiplicty will be settedmultiplicity- the multiplicity to set- Since:
- 2.1.2
-
setNavigable
public void setNavigable(ObjectModelAttribute attribute, boolean navigable)
Adds a navigable flag to the givenattribute.- Parameters:
attribute- the attribute on which the navigable flag will be settednavigable- the navigable flag to set- Since:
- 2.3
-
addComment
public void addComment(ObjectModelElement element, String comment)
Adds a comment to the givenelement.- Parameters:
element- the element on which the comment will be added.comment- the comment to add- Since:
- 2.1.2
-
addAnnotation
public ObjectModelAnnotation addAnnotation(ObjectModelClassifier classifier, ObjectModelElement element, String annotationType)
Add an annotation of the givenelementof the givenclassifier.Important note:
Since 2.6.4, the behaviour of this method has changed, we only allowed now to pass here a annotation type and no longer a annotation string representation with some parameters...
- Parameters:
classifier- holder of element to treatelement- where to add the annotationannotationType- type of annotation to create- Returns:
- the instanciated annotation
-
addAnnotation
public ObjectModelAnnotation addAnnotation(ObjectModelClassifier classifier, ObjectModelElement element, Class<?> annotationType)
Add an annotation of the givenelementof the givenclassifier.- Parameters:
classifier- holder of element to treatelement- where to add the annotationannotationType- type of annotation to create- Returns:
- the instanciated annotation
- Since:
- 2.6.4
-
addAnnotationParameter
public ObjectModelAnnotation addAnnotationParameter(ObjectModelClassifier classifier, ObjectModelAnnotation annotation, String annotationName, Object annotationValue)
Add a parameter to an annotation.- Parameters:
classifier- holder of element to treatannotation- where to add the parameterannotationName- parameter nameannotationValue- paramter value- Returns:
- the annotation
- Since:
- 2.6.4
-
addBlock
public ObjectModelOperation addBlock(ObjectModelClassifier classifier, ObjectModelModifier... modifiers)
add an operation to the classifier with the form of a simple block of code.use it to add a "static {}" block into an classifier, then use setOperationBody with the returned value of this method to complete the creation of the static block
- Parameters:
classifier- the classifier where the block will be addedmodifiers- modifiers for the block- Returns:
- the block added
-
addStereotype
public void addStereotype(ObjectModelElement element, String stereotype)
Add a stereotype to the givenelement.- Parameters:
element- the element on which the stereotype will be addedstereotype- the stereotype to add- Since:
- 2.1.2
-
cloneOperationSignature
public ObjectModelOperation cloneOperationSignature(ObjectModelOperation source, ObjectModelClassifier destination, boolean cloneDocumentation, ObjectModelModifier... modifiers)
Clone thesourceoperation into thedestinationclassifier. name, returnType, parameters, exceptions and tagValues will be cloned. You can specifymodifiersfor the result operation.- Parameters:
source- operation to clonedestination- classifier where result operation will be addedcloneDocumentation- flag to add documentation if some found in modelmodifiers- extra modifiers- Returns:
- the new operation created in destination classifier
- Since:
- 2.1.2
-
cloneOperation
public ObjectModelOperation cloneOperation(ObjectModelOperation source, ObjectModelClassifier destination, boolean cloneDocumentation, ObjectModelJavaModifier... modifiers)
Clone thesourceoperation into thedestinationclassifier. whole signature, tagValues and body code will be cloned. You can specifymodifiersfor the result operation.- Parameters:
source- operation to clonedestination- classifier where result operation will be addedcloneDocumentation- flag to add documentation if some found in modelmodifiers- extra modifiers- Returns:
- the new operation created in destination classifier
- Since:
- 2.1.2
-
cloneAttribute
protected ObjectModelAttribute cloneAttribute(ObjectModelAttribute source, ObjectModelClassifier destination, boolean cloneDocumentation, ObjectModelModifier... modifiers)
clone a given attribute into a classifier of the output model- Parameters:
source- the original attributedestination- classifier where the clone will be addedcloneDocumentation- flag to add documentation if some found in modelmodifiers- extra modifiers- Returns:
- the clone attribute
- Since:
- 2.1.2
-
cloneTagValues
protected void cloneTagValues(ObjectModelElement source, ObjectModelElement destination)
Copy all tag values fro the givensourceto the givendestination.- Parameters:
source- the source elementdestination- the destination element- Since:
- 2.3
-
cloneStereotypes
protected void cloneStereotypes(ObjectModelClassifier source, ObjectModelClassifier destination)
- Parameters:
source- the source elementdestination- the source element- Since:
- 2.3
-
copyClassifier
@Deprecated protected void copyClassifier(ObjectModelClassifier source, ObjectModelClassifier destination, boolean copyDocumentation)
Deprecated.since 2.3, prefer use thecloneClass(ObjectModelClass, boolean)methodcopy attributes, interfaces declartion and operation of a given classifier into another classifier.class-specific, enumeration-specific and interface-specific features of the given classifier will not be present in the clone. To copy those specific elements, use
- Parameters:
source- the classifier to clone from the source modeldestination- where to clone the given source onecopyDocumentation- flag to add documentation if some found in modelcloneClassifier(ObjectModelClassifier, boolean)- Since:
- 2.1.2
-
cloneClassifier
protected void cloneClassifier(ObjectModelClassifier source, ObjectModelClassifier destination, boolean copyDocumentation)
copy attributes, interfaces declartion and operation of a given classifier into another classifier.class-specific, enumeration-specific and interface-specific features of the given classifier will not be present in the clone. To copy those specific elements, use
- Parameters:
source- the classifier to clone from the source modeldestination- where to clone the given source onecopyDocumentation- flag to add documentation if some found in modelcloneClassifier(ObjectModelClassifier, boolean)- Since:
- 2.3
-
cloneClass
public ObjectModelClass cloneClass(ObjectModelClass source, boolean cloneDocumentation)
creates a clone of the givensourceclass in the output model and clones attributes, inheritence declarations and operations into the clone- Parameters:
source- the class to clone from the source modelcloneDocumentation- flag to add documentation if some found in model- Returns:
- the clone of the given class
- Since:
- 2.1.2
-
cloneInterface
public ObjectModelInterface cloneInterface(ObjectModelInterface source, boolean cloneDocumentation)
creates a clone of the givensourceinterface in the output model and clones attributes, inheritence declaration and operations into the clone- Parameters:
source- the interface to clone from the source modelcloneDocumentation- flag to add documentation if some found in model- Returns:
- the clone of the given interface
- Since:
- 2.1.2
-
cloneEnumeration
public ObjectModelEnumeration cloneEnumeration(ObjectModelEnumeration source, boolean cloneDocumentation)
creates a clone of the givensourceenumeration in the output model and clones attributes, inheritence declaration, operations and literals into the clone- Parameters:
source- the enumeration to clone from the source modelcloneDocumentation- flag to add documentation if some found in model- Returns:
- the clone of the given enumeration
- Since:
- 2.1.2
-
cloneClassifier
public ObjectModelClassifier cloneClassifier(ObjectModelClassifier source, boolean cloneDocumentation)
creates a clone of the givensourceclassifier in the output model and clones attributes, inheritence declaration and operationsclass-specific, enumeration-specific and interface-specific features of the given classifier will be present in the clone
- Parameters:
source- the classifier to clone from the source modelcloneDocumentation- flag to add documentation if some found in model- Returns:
- the clone of the given classifier
- Since:
- 2.1.2
-
addConstantsFromDependency
protected Set<String> addConstantsFromDependency(ObjectModelClassifier input, ObjectModelClassifier output)
Search ininputmodel, for a enumeration dependency namedJavaGeneratorUtil.DEPENDENCIES_CONSTANTS.If found, add all literals on
outputmodel as constants.You can add a
EugeneCoreTagValues.Store.constantPrefixto your enumeration to prefix constant names.- Parameters:
input- the input modeloutput- the ouput model- Returns:
- the set of constants names generated
-
getConstantPrefix
public String getConstantPrefix()
-
setConstantPrefix
public void setConstantPrefix(String constantPrefix)
-
getJavaBeanMethodName
protected String getJavaBeanMethodName(String methodPrefix, String propertyName)
-
getJavaBeanMethodName
protected String getJavaBeanMethodName(String methodPrefix, String propertyName, String methodSuffix)
-
initConstantPrefixFromModel
public void initConstantPrefixFromModel()
Used to initialize constant prefix depends on model tagvalueEugeneCoreTagValues.Store.constantPrefix. If no tagvalue found, the default value will be an empty prefix.
-
generateI18nBlock
protected void generateI18nBlock(ObjectModelClassifier input, ObjectModelClassifier output, String i18nPrefix)
Generates a static block with I18n keys for each navigable attributes prefixed by the giveni18nPrefix.- Parameters:
input- the input classifieroutput- the output classifier (to generate)i18nPrefix- the i81n prefix to use
-
addI18n
protected void addI18n(StringBuilder buffer, String i18nPrefix, String suffix)
-
isInClassPath
@Deprecated protected boolean isInClassPath(ObjectModelClassifier classifier)
Deprecated.since 3.0, use theTemplate.getResourcesHelper()object directly.Checks if the classifier fully qualified name is in class-path and log a message that fqn will not generated if found- Parameters:
classifier- classifier to test- Returns:
trueif fqn of classifier was found in class-path,falseotherwise.- Since:
- 2.5
-
isInClassPath
@Deprecated protected boolean isInClassPath(String fqn)
Deprecated.since 3.0, use theTemplate.getResourcesHelper()object directly.Checks if the given fully qualified name is in class-path and log a message that fqn will not generated if found.- Parameters:
fqn- fully qualified name to test- Returns:
trueif fqn was found in class-path,falseotherwise.- Since:
- 2.5
-
isInClassPath
@Deprecated protected boolean isInClassPath(String packageName, String className)
Deprecated.since 3.0, use theTemplate.getResourcesHelper()object directly.Checks if the given class (by his package and simple class name) is in class-path and log a message that fqn will not generated if found.- Parameters:
packageName- package name of the class to testclassName- class simple name of the class to test- Returns:
trueif fqn was found in class-path,falseotherwise.- Since:
- 2.7.1
-
storeServiceLoaderFile
protected void storeServiceLoaderFile(Class<?> type, List<? extends ObjectModelClassifier> classes, Function<? super ObjectModelClassifier,String> function)
-
toQualifiedNames
protected List<String> toQualifiedNames(List<? extends ObjectModelClassifier> classes, Function<? super ObjectModelClassifier,String> function)
-
-