From 3d9520b10297925b05d10118357923fc60816353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=8Cedomir=20Igaly?= Date: Thu, 24 Oct 2024 09:38:53 +0200 Subject: [PATCH] HHH-18693 Add underscore as prefix to single upper case letter in org.hibernate.processor.util.StringUtil#getUpperUnderscoreCaseFromLowerCamelCase --- .../src/main/java/org/hibernate/processor/util/StringUtil.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/StringUtil.java b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/StringUtil.java index 83bc5a54fa6b..f1e9ddad5404 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/StringUtil.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/StringUtil.java @@ -98,6 +98,9 @@ public static String nameToMethodName(String name) { } public static String getUpperUnderscoreCaseFromLowerCamelCase(String lowerCamelCaseString) { + if ( lowerCamelCaseString.length() == 1 && Character.isUpperCase( lowerCamelCaseString.charAt( 0 ) ) ) { + return "_" + lowerCamelCaseString; + } final StringBuilder result = new StringBuilder(); int position = 0; while ( position < lowerCamelCaseString.length() ) {