This is an automated email from the ASF dual-hosted git repository.

rmannibucau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/johnzon.git

commit f4d074be27122e7bf022c64b1f37704fcb84b42c
Author: Romain Manni-Bucau <rmannibu...@gmail.com>
AuthorDate: Tue Aug 9 10:31:33 2022 +0200

    [JOHNZON-387] inject more data in afterEnumName to avoid subclasses to 
recompute it
---
 .../org/apache/johnzon/jsonschema/generator/PojoGenerator.java   | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/johnzon-jsonschema/src/main/java/org/apache/johnzon/jsonschema/generator/PojoGenerator.java
 
b/johnzon-jsonschema/src/main/java/org/apache/johnzon/jsonschema/generator/PojoGenerator.java
index 7264ddc5..5db62394 100644
--- 
a/johnzon-jsonschema/src/main/java/org/apache/johnzon/jsonschema/generator/PojoGenerator.java
+++ 
b/johnzon-jsonschema/src/main/java/org/apache/johnzon/jsonschema/generator/PojoGenerator.java
@@ -210,7 +210,12 @@ public class PojoGenerator {
         return "";
     }
 
-    protected String afterEnumName() {
+    /**
+     * @param values the enum values (key is json name, value is java name).
+     * @param valuesAreInjected is there a toString() with json name or is the 
enum anemic (only values, no method)
+     * @return the data to add after enum name and before the opening brace in 
enum declaration.
+     */
+    protected String afterEnumName(final Map<String, String> values, final 
boolean valuesAreInjected) {
         return "";
     }
 
@@ -329,7 +334,7 @@ public class PojoGenerator {
                         "package " + configuration.getPackageName() + ";\n" +
                         "\n" +
                         enumImports() +
-                        "public enum " + className + afterEnumName() + " {\n" +
+                        "public enum " + className + afterEnumName(values, 
injectValues) + " {\n" +
                         values.entrySet().stream()
                                 .map(it -> "" +
                                         (injectValues && 
configuration.isAddJsonbProperty() ?

Reply via email to