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
The following commit(s) were added to refs/heads/master by this push: new 544311af try to have more java friendly names in PojoGenerator 544311af is described below commit 544311af11052adaa686368c8cf8b1a57935c024 Author: Romain Manni-Bucau <rmannibu...@gmail.com> AuthorDate: Mon Aug 8 17:31:53 2022 +0200 try to have more java friendly names in PojoGenerator --- .../johnzon/jsonschema/generator/PojoGenerator.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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 62bb2ccb..29316bec 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 @@ -548,12 +548,32 @@ public class PojoGenerator { name += "Value"; } + if (name.contains("_")) { + name = toCamelCase(name); + } + if (!Objects.equals(key, name) && configuration.isAddJsonbProperty()) { imports.add(JsonbProperty.class.getName()); } return name; } + protected String toCamelCase(final String name) { + final StringBuilder out = new StringBuilder(name.length()); + boolean up = true; + for (final char c : name.toCharArray()) { + if (up) { + out.append(Character.isUpperCase(c)); + up = false; + } else if (c == '_') { + up = true; + } else { + out.append(c); + } + } + return out.toString(); + } + protected boolean isReserved(final String name) { return "continue".equals(name) || "break".equals(name) || "default".equals(name) || "do".equals(name) || "while".equals(name) ||