You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@johnzon.apache.org by rm...@apache.org on 2022/08/17 07:45:28 UTC
[johnzon] 01/02: fixing all args constructor, fluent setter indentation+returned type for pojo generator
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 645fa23fd595dbe1ed00b8894c5c9f2f5a67fe0a
Author: Romain Manni-Bucau <rm...@gmail.com>
AuthorDate: Wed Aug 17 09:45:13 2022 +0200
fixing all args constructor, fluent setter indentation+returned type for pojo generator
---
.../apache/johnzon/jsonschema/generator/PojoGenerator.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 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 2b36e3cd..8835b45f 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
@@ -89,8 +89,7 @@ public class PojoGenerator {
" @Override\n" +
" public boolean equals(final Object other) {\n" +
" return other instanceof " + configuration.getClassName() + ";\n" +
- " }\n" +
- "}\n") :
+ " }\n") :
(attributes.stream()
.map(a -> "" +
(configuration.isAddJsonbProperty() && !Objects.equals(a.javaName, a.jsonName) ?
@@ -115,7 +114,9 @@ public class PojoGenerator {
.collect(joining()),
"",
") {\n" +
- " // no-op\n" +
+ attributes.stream()
+ .map(a -> " this." + a.getJavaName() + " = " + a.javaName + ";\n")
+ .collect(joining()) +
" }\n\n")) :
"") +
attributes.stream()
@@ -127,10 +128,10 @@ public class PojoGenerator {
" }\n" +
"\n" +
" public " +
- (configuration.isFluentSetters() ? a.type : "void") +
+ (configuration.isFluentSetters() ? configuration.getClassName() : "void") +
" set" + marker + "(final " + a.type + " " + a.javaName + ") {\n" +
" this." + a.javaName + " = " + a.javaName + ";\n" +
- (configuration.isFluentSetters() ? " return this;\n" : "") +
+ (configuration.isFluentSetters() ? " return this;\n" : "") +
" }\n" +
"";
})