Author: alexsmirnov
Date: 2010-12-22 20:04:48 -0500 (Wed, 22 Dec 2010)
New Revision: 20760
Modified:
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java
Log:
CODING IN PROGRESS - issue RF-9323: CDK annotation @RendererSpecificComponent.attributes
doesn't work
https://issues.jboss.org/browse/RF-9323
Modified:
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java
===================================================================
---
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java 2010-12-22
23:47:13 UTC (rev 20759)
+++
branches/RF-9323/cdk/generator/src/main/java/org/richfaces/cdk/apt/AptSourceUtils.java 2010-12-23
01:04:48 UTC (rev 20760)
@@ -143,8 +143,6 @@
} else {
}
- } else if (isBooleanGetter(method)) {
-
} else if (isSetter(method)) {
}
@@ -274,19 +272,31 @@
private boolean isGetter(ExecutableElement e) {
String methodName = e.getSimpleName().toString();
- return methodName.startsWith("get") && methodName.length()>3
&& Character.isUpperCase(methodName.charAt(3)) && 0 ==
e.getParameters().size();
+ return (isGetterName(methodName)||isBooleanGetterName(methodName)) && 0
== e.getParameters().size();
}
+
+ private boolean isGetterName(String methodName) {
+ return methodName.startsWith("get") && methodName.length()>3
&& Character.isUpperCase(methodName.charAt(3));
+ }
private boolean isBooleanGetter(ExecutableElement e) {
String methodName = e.getSimpleName().toString();
- return methodName.startsWith("is") && methodName.length()>2
&& Character.isUpperCase(methodName.charAt(2)) && 0 ==
e.getParameters().size() && TypeKind.BOOLEAN.equals(e.getReturnType().getKind());
+ return isBooleanGetterName(methodName) && 0 == e.getParameters().size()
&& TypeKind.BOOLEAN.equals(e.getReturnType().getKind());
}
+
+ private boolean isBooleanGetterName(String methodName) {
+ return methodName.startsWith("is") && methodName.length()>2
&& Character.isUpperCase(methodName.charAt(2));
+ }
private boolean isSetter(ExecutableElement e) {
String methodName = e.getSimpleName().toString();
- return methodName.startsWith("set") && methodName.length()>3
&& Character.isUpperCase(methodName.charAt(3)) && 1 ==
e.getParameters().size() && !e.isVarArgs() &&
TypeKind.VOID.equals(e.getReturnType().getKind());
+ return isSetterName(methodName) && 1 == e.getParameters().size()
&& !e.isVarArgs() && TypeKind.VOID.equals(e.getReturnType().getKind());
}
+ private boolean isSetterName(String methodName) {
+ return methodName.startsWith("set") && methodName.length()>3
&& Character.isUpperCase(methodName.charAt(3));
+ }
+
private ClassName asClassDescription(TypeMirror type) {
return new ClassName(type.toString());
}