branch feature/308-generated-annotation-configuration updated (3c6d1250 -> 8a58e3c9)
This is an automated email from the git hooks/post-receive script. New change to branch feature/308-generated-annotation-configuration in repository eugene. See https://gitlab.nuiton.org/nuiton/eugene.git omits 3c6d1250 refs #308: Correction des traductions omits 658ab7d2 refs #308: Add configuration for @Generated annotation adds 72afd62d Update parent pom new 01081945 refs #308: Add configuration for @Generated annotation new 8a58e3c9 refs #308: Correction des traductions This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (3c6d1250) \ N -- N -- N refs/heads/feature/308-generated-annotation-configuration (8a58e3c9) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omits" are not gone; other references still refer to them. Any revisions marked "discards" are gone forever. The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 8a58e3c942b82985e10d78bd2a9f17dc3d48b766 Author: Eric Chatellier <chatellier@codelutin.com> Date: Tue Dec 10 11:36:25 2019 +0100 refs #308: Correction des traductions commit 01081945e56eaccc83820854ca594efc90db18b0 Author: Eric Chatellier <chatellier@codelutin.com> Date: Tue Dec 10 09:57:12 2019 +0100 refs #308: Add configuration for @Generated annotation Summary of changes: pom.xml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/308-generated-annotation-configuration in repository eugene. See https://gitlab.nuiton.org/nuiton/eugene.git commit 01081945e56eaccc83820854ca594efc90db18b0 Author: Eric Chatellier <chatellier@codelutin.com> Date: Tue Dec 10 09:57:12 2019 +0100 refs #308: Add configuration for @Generated annotation --- .../org/nuiton/eugene/EugeneCoreTagValues.java | 25 +++++++++++++++++++++- .../eugene/java/ObjectModelTransformerToJava.java | 23 +++++++++++--------- .../main/resources/i18n/eugene_en_GB.properties | 1 + .../main/resources/i18n/eugene_fr_FR.properties | 1 + 4 files changed, 39 insertions(+), 11 deletions(-) diff --git a/eugene/src/main/java/org/nuiton/eugene/EugeneCoreTagValues.java b/eugene/src/main/java/org/nuiton/eugene/EugeneCoreTagValues.java index f91e40ef..c53a7ddf 100644 --- a/eugene/src/main/java/org/nuiton/eugene/EugeneCoreTagValues.java +++ b/eugene/src/main/java/org/nuiton/eugene/EugeneCoreTagValues.java @@ -92,7 +92,7 @@ public class EugeneCoreTagValues extends DefaultTagValueMetadatasProvider { constantPrefix(n("eugene.core.tagValues.constantPrefix"), String.class, "PROPERTY_", ObjectModel.class, ObjectModelPackage.class, ObjectModelClassifier.class), /** - * Tag value to specify the i18n prefix to use whene generating i18n keys. + * Tag value to specify the i18n prefix to use where generating i18n keys. * * You can globaly use it on the complete model or to a specific classifier. * @@ -100,6 +100,15 @@ public class EugeneCoreTagValues extends DefaultTagValueMetadatasProvider { */ i18n(n("eugene.core.tagValues.i18n"), String.class, null, ObjectModel.class, ObjectModelPackage.class, ObjectModelClassifier.class), + /** + * Tag value to specify the @Generated annotation class name. + * + * You can globaly use it on the complete model or to a specific classifier. + * + * @since 3.0 + */ + generatedAnnotation(n("eugene.core.tagValues.generatedAnnotation"), String.class, null, ObjectModel.class, ObjectModelPackage.class, ObjectModelClassifier.class), + /** * Tag value to generate also {@code getXXX} methods for a boolean property. * @@ -240,6 +249,20 @@ public class EugeneCoreTagValues extends DefaultTagValueMetadatasProvider { return TagValueUtil.findTagValue(Store.i18n, element, aPackage, model); } + /** + * Cherche et renvoie le préfixe i18n à utiliser sur cet element, sinon sur + * le model. + * + * @param element element to seek + * @param aPackage package to seek + * @param model model to seek + * @return le préfixe i18n ou <code>null</code> si non spécifié + * @since 2.3 + */ + public String getGeneratedAnnotationTagValue(ObjectModelElement element, ObjectModelPackage aPackage, ObjectModel model) { + return TagValueUtil.findTagValue(Store.generatedAnnotation, element, aPackage, model); + } + /** * Obtain the value of the {@link Store#generateBooleanGetMethods} * tag value on the given model, package or classifier. diff --git a/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java b/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java index dd127c27..9566f505 100644 --- a/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java +++ b/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java @@ -47,7 +47,6 @@ import org.nuiton.eugene.models.object.ObjectModelTransformer; import org.nuiton.eugene.models.object.ObjectModelType; import org.nuiton.i18n.I18n; -import javax.annotation.Generated; import java.beans.Introspector; import java.net.URL; import java.util.Collection; @@ -121,19 +120,21 @@ public abstract class ObjectModelTransformerToJava extends ObjectModelTransforme } /** - * Add the {@link Generated} annotation to the given {@link ObjectModelClassifier} + * Add the {@code Generated} annotation to the given {@link ObjectModelClassifier} * * @param element the element to be generated on which the annotation will be added * @since 2.7 */ - // TODO AThimel 06/07/13 Maybe be skipped by configuration ? protected void addGeneratedAnnotation(ObjectModelClassifier element) { - - String generatorName = getClass().getName(); - Date now = new Date(); - ObjectModelAnnotation annotation = addAnnotation(element, element, Generated.class); - addAnnotationParameter(element, annotation, "value", generatorName); - addAnnotationParameter(element, annotation, "date", now.toString()); + ObjectModelPackage aPackage = getPackage(element); + String generatedAnnotation = eugeneTagValues.getGeneratedAnnotationTagValue(element, aPackage, model); + if (generatedAnnotation != null) { + String generatorName = getClass().getName(); + Date now = new Date(); + ObjectModelAnnotation annotation = addAnnotation(element, element, generatedAnnotation); + addAnnotationParameter(element, annotation, "value", generatorName); + addAnnotationParameter(element, annotation, "date", now.toString()); + } } protected ObjectModelClass createClass(String name, String packageName) { @@ -444,7 +445,9 @@ public abstract class ObjectModelTransformerToJava extends ObjectModelTransforme public ObjectModelAnnotation addAnnotation(ObjectModelClassifier classifier, ObjectModelElement element, String annotationType) { - return builder.addAnnotation(classifier, element, annotationType); + addImport(classifier, annotationType); + String simpleClassName = GeneratorUtil.getClassNameFromQualifiedName(annotationType); + return builder.addAnnotation(classifier, element, simpleClassName); } /** diff --git a/eugene/src/main/resources/i18n/eugene_en_GB.properties b/eugene/src/main/resources/i18n/eugene_en_GB.properties index 9360a93c..2048ca46 100644 --- a/eugene/src/main/resources/i18n/eugene_en_GB.properties +++ b/eugene/src/main/resources/i18n/eugene_en_GB.properties @@ -2,6 +2,7 @@ eugene.core.tagValues.attributeGeneric=Generic type of attribute eugene.core.tagValues.constantPrefix=Constant field prefix eugene.core.tagValues.documentation=Documentation eugene.core.tagValues.generateBooleanGetMethods=Generate getter on Boolean +eugene.core.tagValues.generatedAnnotation=@Generated annotation class name eugene.core.tagValues.i18n=I18n prefix eugene.core.tagValues.ordered=Is attribute ordererd ? eugene.core.tagValues.skip=Skip generation diff --git a/eugene/src/main/resources/i18n/eugene_fr_FR.properties b/eugene/src/main/resources/i18n/eugene_fr_FR.properties index d1594f2b..8fe8d868 100644 --- a/eugene/src/main/resources/i18n/eugene_fr_FR.properties +++ b/eugene/src/main/resources/i18n/eugene_fr_FR.properties @@ -2,6 +2,7 @@ eugene.core.tagValues.attributeGeneric=Type générique de l'attribut eugene.core.tagValues.constantPrefix=Préfixe des constantes eugene.core.tagValues.documentation=Documentation eugene.core.tagValues.generateBooleanGetMethods=Génerer les getters sur le type Boolean +eugene.core.tagValues.generatedAnnotation=@Generated annotation class name eugene.core.tagValues.i18n=Préfix i18n eugene.core.tagValues.ordered=L'attribut est-il ordonné ? eugene.core.tagValues.skip=Ne pas générer -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/308-generated-annotation-configuration in repository eugene. See https://gitlab.nuiton.org/nuiton/eugene.git commit 8a58e3c942b82985e10d78bd2a9f17dc3d48b766 Author: Eric Chatellier <chatellier@codelutin.com> Date: Tue Dec 10 11:36:25 2019 +0100 refs #308: Correction des traductions --- eugene/src/main/resources/i18n/eugene_en_GB.properties | 2 +- eugene/src/main/resources/i18n/eugene_fr_FR.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eugene/src/main/resources/i18n/eugene_en_GB.properties b/eugene/src/main/resources/i18n/eugene_en_GB.properties index 2048ca46..9c041108 100644 --- a/eugene/src/main/resources/i18n/eugene_en_GB.properties +++ b/eugene/src/main/resources/i18n/eugene_en_GB.properties @@ -2,7 +2,7 @@ eugene.core.tagValues.attributeGeneric=Generic type of attribute eugene.core.tagValues.constantPrefix=Constant field prefix eugene.core.tagValues.documentation=Documentation eugene.core.tagValues.generateBooleanGetMethods=Generate getter on Boolean -eugene.core.tagValues.generatedAnnotation=@Generated annotation class name +eugene.core.tagValues.generatedAnnotation=@Generated annotation fully qualified name eugene.core.tagValues.i18n=I18n prefix eugene.core.tagValues.ordered=Is attribute ordererd ? eugene.core.tagValues.skip=Skip generation diff --git a/eugene/src/main/resources/i18n/eugene_fr_FR.properties b/eugene/src/main/resources/i18n/eugene_fr_FR.properties index 8fe8d868..cce361dd 100644 --- a/eugene/src/main/resources/i18n/eugene_fr_FR.properties +++ b/eugene/src/main/resources/i18n/eugene_fr_FR.properties @@ -2,7 +2,7 @@ eugene.core.tagValues.attributeGeneric=Type générique de l'attribut eugene.core.tagValues.constantPrefix=Préfixe des constantes eugene.core.tagValues.documentation=Documentation eugene.core.tagValues.generateBooleanGetMethods=Génerer les getters sur le type Boolean -eugene.core.tagValues.generatedAnnotation=@Generated annotation class name +eugene.core.tagValues.generatedAnnotation=Nom qualifié de l'annotation @Generated eugene.core.tagValues.i18n=Préfix i18n eugene.core.tagValues.ordered=L'attribut est-il ordonné ? eugene.core.tagValues.skip=Ne pas générer -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm