diff options
Diffstat (limited to 'src/lombok/core/TransformationsUtil.java')
-rw-r--r-- | src/lombok/core/TransformationsUtil.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lombok/core/TransformationsUtil.java b/src/lombok/core/TransformationsUtil.java new file mode 100644 index 00000000..0ce99d9f --- /dev/null +++ b/src/lombok/core/TransformationsUtil.java @@ -0,0 +1,18 @@ +package lombok.core; + +public class TransformationsUtil { + private TransformationsUtil() {} + + public static String toGetterName(CharSequence fieldName, boolean isBoolean) { + final String prefix = isBoolean ? "is" : "get"; + final String suffix; + + if ( fieldName.length() == 0 ) return prefix; + + char first = fieldName.charAt(0); + if ( Character.isLowerCase(first) ) + suffix = String.format("%s%s", Character.toTitleCase(first), fieldName.subSequence(1, fieldName.length())); + else suffix = fieldName.toString(); + return String.format("%s%s", prefix, suffix); + } +} |