aboutsummaryrefslogtreecommitdiff
path: root/src/lombok/javac/handlers/PKG.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-06-16 03:04:46 +0200
committerReinier Zwitserloot <reinier@tipit.to>2009-06-16 03:04:46 +0200
commitf36be2eb01bcbff01a513d64bff2d1aba54460b1 (patch)
tree7d49ebe90cb836e054c35d2a4382be6b999ca452 /src/lombok/javac/handlers/PKG.java
parentd78a04d74886101c81de77659b067d16cb2d0de2 (diff)
downloadlombok-f36be2eb01bcbff01a513d64bff2d1aba54460b1.tar.gz
lombok-f36be2eb01bcbff01a513d64bff2d1aba54460b1.tar.bz2
lombok-f36be2eb01bcbff01a513d64bff2d1aba54460b1.zip
Implemented a lot of stuff for javac, but we ran into 2 major issues still to be implemented:
1. The visit mode of a lombok handler (does not trigger off of annotations, instead sees every field, method, type, and statement), needs to be coded, 2. triggering off of annotations via APT's annotation handling system skips method-local classes. We'll need to recode this via an AST visitor like we need for issue #1 Other than that, triggering off of annotations works swimmingly!
Diffstat (limited to 'src/lombok/javac/handlers/PKG.java')
-rw-r--r--src/lombok/javac/handlers/PKG.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/lombok/javac/handlers/PKG.java b/src/lombok/javac/handlers/PKG.java
new file mode 100644
index 00000000..4622c3ee
--- /dev/null
+++ b/src/lombok/javac/handlers/PKG.java
@@ -0,0 +1,34 @@
+package lombok.javac.handlers;
+
+import java.lang.reflect.Modifier;
+
+import javax.lang.model.element.Element;
+import javax.lang.model.type.TypeKind;
+
+import lombok.AccessLevel;
+import lombok.core.TransformationsUtil;
+
+class PKG {
+ static String toGetterName(Element field) {
+ CharSequence fieldName = field.getSimpleName();
+
+ boolean isBoolean = field.asType().getKind() == TypeKind.BOOLEAN;
+
+ return TransformationsUtil.toGetterName(fieldName, isBoolean);
+ }
+
+ static int toJavacModifier(AccessLevel accessLevel) {
+ switch ( accessLevel ) {
+ case MODULE:
+ case PACKAGE:
+ return 0;
+ default:
+ case PUBLIC:
+ return Modifier.PUBLIC;
+ case PRIVATE:
+ return Modifier.PRIVATE;
+ case PROTECTED:
+ return Modifier.PROTECTED;
+ }
+ }
+}