From 049ed7ce7ca35f11cc62d57e9575978b9c464c4f Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Wed, 3 Jun 2020 12:59:44 -0400 Subject: [PATCH] ContextProperty -> DataElementTemplateProperty And add preliminary PersistenceHandlerTemplateProperty Signed-off-by: Daniel Bluhm --- .../processors/DataElementProcessor.java | 8 ++++---- ....java => DataElementTemplateProperty.java} | 16 ++++++---------- .../PersistenceHandlerTemplateProperty.java | 19 +++++++++++++++++++ 3 files changed, 29 insertions(+), 14 deletions(-) rename org.eclipse.ice.dev.annotations/src/main/java/org/eclipse/ice/dev/annotations/processors/{ContextProperty.java => DataElementTemplateProperty.java} (59%) create mode 100644 org.eclipse.ice.dev.annotations/src/main/java/org/eclipse/ice/dev/annotations/processors/PersistenceHandlerTemplateProperty.java diff --git a/org.eclipse.ice.dev.annotations/src/main/java/org/eclipse/ice/dev/annotations/processors/DataElementProcessor.java b/org.eclipse.ice.dev.annotations/src/main/java/org/eclipse/ice/dev/annotations/processors/DataElementProcessor.java index 07cc7b99e..15d7a257f 100644 --- a/org.eclipse.ice.dev.annotations/src/main/java/org/eclipse/ice/dev/annotations/processors/DataElementProcessor.java +++ b/org.eclipse.ice.dev.annotations/src/main/java/org/eclipse/ice/dev/annotations/processors/DataElementProcessor.java @@ -267,10 +267,10 @@ private void writeClass(final String interfaceName, final List fields) th // Prepare context of template final VelocityContext context = new VelocityContext(); - context.put(ContextProperty.PACKAGE.key(), packageName); - context.put(ContextProperty.INTERFACE.key(), simpleName); - context.put(ContextProperty.CLASS.key(), generatedSimpleClassName); - context.put(ContextProperty.FIELDS.key(), fields); + context.put(DataElementTemplateProperty.PACKAGE.getKey(), packageName); + context.put(DataElementTemplateProperty.INTERFACE.getKey(), simpleName); + context.put(DataElementTemplateProperty.CLASS.getKey(), generatedSimpleClassName); + context.put(DataElementTemplateProperty.FIELDS.getKey(), fields); // Write to file final JavaFileObject generatedClassFile = processingEnv.getFiler().createSourceFile(generatedClassName); diff --git a/org.eclipse.ice.dev.annotations/src/main/java/org/eclipse/ice/dev/annotations/processors/ContextProperty.java b/org.eclipse.ice.dev.annotations/src/main/java/org/eclipse/ice/dev/annotations/processors/DataElementTemplateProperty.java similarity index 59% rename from org.eclipse.ice.dev.annotations/src/main/java/org/eclipse/ice/dev/annotations/processors/ContextProperty.java rename to org.eclipse.ice.dev.annotations/src/main/java/org/eclipse/ice/dev/annotations/processors/DataElementTemplateProperty.java index 58e73b564..33c4e622f 100644 --- a/org.eclipse.ice.dev.annotations/src/main/java/org/eclipse/ice/dev/annotations/processors/ContextProperty.java +++ b/org.eclipse.ice.dev.annotations/src/main/java/org/eclipse/ice/dev/annotations/processors/DataElementTemplateProperty.java @@ -1,21 +1,17 @@ package org.eclipse.ice.dev.annotations.processors; +import lombok.AllArgsConstructor; +import lombok.Getter; + /** * Enumeration for Keys used in DataElement Velocity Template. */ -enum ContextProperty { +@AllArgsConstructor +enum DataElementTemplateProperty { PACKAGE("package"), FIELDS("fields"), INTERFACE("interface"), CLASS("class"); - private String key; - - ContextProperty(String key) { - this.key = key; - } - - String key() { - return this.key; - } + @Getter private String key; } \ No newline at end of file diff --git a/org.eclipse.ice.dev.annotations/src/main/java/org/eclipse/ice/dev/annotations/processors/PersistenceHandlerTemplateProperty.java b/org.eclipse.ice.dev.annotations/src/main/java/org/eclipse/ice/dev/annotations/processors/PersistenceHandlerTemplateProperty.java new file mode 100644 index 000000000..53cf3d3ac --- /dev/null +++ b/org.eclipse.ice.dev.annotations/src/main/java/org/eclipse/ice/dev/annotations/processors/PersistenceHandlerTemplateProperty.java @@ -0,0 +1,19 @@ +package org.eclipse.ice.dev.annotations.processors; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * Enumeration of keys of Persistence Handler Template. + * @author Daniel Bluhm + */ +@AllArgsConstructor +enum PersistenceHandlerTemplateProperty { + PACKAGE("package"), + ELEMENT_INTERFACE("elementInterface"), + CLASS("class"), + COLLECTION("collection"), + IMPLEMENTATION("implementation"); + + @Getter private String key; +} \ No newline at end of file