diff options
author | Reinier Zwitserloot <reinier@tipit.to> | 2009-06-17 21:27:27 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@tipit.to> | 2009-06-17 21:27:27 +0200 |
commit | 1929a28c9def0dd276dcf3fdb70ada8b84b1c64a (patch) | |
tree | 7d0b7b7c6bdcce6fcde7973b4cf2d8f46b854b79 /src/lombok/core | |
parent | 7c65e0fdff6a015b9773a0f6d6b5d8adf8cd9434 (diff) | |
download | lombok-1929a28c9def0dd276dcf3fdb70ada8b84b1c64a.tar.gz lombok-1929a28c9def0dd276dcf3fdb70ada8b84b1c64a.tar.bz2 lombok-1929a28c9def0dd276dcf3fdb70ada8b84b1c64a.zip |
Added the SetterHandler for javac. Also added a way to get the SymbolTable on a JavacAST.Node, because you need it to e.g. access constant types like 'void'.
Diffstat (limited to 'src/lombok/core')
-rw-r--r-- | src/lombok/core/TransformationsUtil.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/lombok/core/TransformationsUtil.java b/src/lombok/core/TransformationsUtil.java index 0ce99d9f..8aea09a4 100644 --- a/src/lombok/core/TransformationsUtil.java +++ b/src/lombok/core/TransformationsUtil.java @@ -5,14 +5,22 @@ public class 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); + return buildName(prefix, fieldName.toString()); + } + + private static String buildName(String prefix, String suffix) { + if ( suffix.length() == 0 ) return prefix; + + char first = suffix.charAt(0); if ( Character.isLowerCase(first) ) - suffix = String.format("%s%s", Character.toTitleCase(first), fieldName.subSequence(1, fieldName.length())); - else suffix = fieldName.toString(); + suffix = String.format("%s%s", Character.toTitleCase(first), suffix.subSequence(1, suffix.length())); return String.format("%s%s", prefix, suffix); } + + public static String toSetterName(CharSequence fieldName) { + return buildName("set", fieldName.toString()); + } } |