Author: scabanovich
Date: 2012-05-10 20:18:47 -0400 (Thu, 10 May 2012)
New Revision: 40935
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/BeanUtil.java
Log:
JBIDE-11838
https://issues.jboss.org/browse/JBIDE-11838
Public util method for for checking getter return type is added.
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/BeanUtil.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/BeanUtil.java 2012-05-11
00:13:13 UTC (rev 40934)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/BeanUtil.java 2012-05-11
00:18:47 UTC (rev 40935)
@@ -38,15 +38,12 @@
&& checkPropertyReturnType(method);
}
- private static boolean checkPropertyReturnType(IMethod method) {
- if(method == null) {
- return false;
- }
- String typeName = EclipseJavaUtil.getMemberTypeAsString(method);
+
+ public static boolean checkPropertyReturnType(String typeName, String methodName) {
if(typeName == null || typeName.equals("void")) { //$NON-NLS-1$
return false;
}
- if(method.getElementName().startsWith(BeanUtil.IS)) {
+ if(methodName.startsWith(BeanUtil.IS)) {
if(!"boolean".equals(typeName) &&
!"java.lang.Boolean".equals(typeName)) { //$NON-NLS-1$ //$NON-NLS-2$
return false;
}
@@ -54,6 +51,10 @@
return true;
}
+ private static boolean checkPropertyReturnType(IMethod method) {
+ return method != null &&
checkPropertyReturnType(EclipseJavaUtil.getMemberTypeAsString(method),
method.getElementName());
+ }
+
public static boolean isSetter(IMethod method) {
return method != null && isSetter(method.getElementName(),
method.getNumberOfParameters());
}