You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2013/08/01 09:58:50 UTC
[2/4] git commit: ISIS-482: tidy-up
ISIS-482: tidy-up
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/6126bb1d
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/6126bb1d
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/6126bb1d
Branch: refs/heads/master
Commit: 6126bb1da51bfa78fb788da4c10a8555dab3b46b
Parents: 54ad066
Author: Dan Haywood <da...@apache.org>
Authored: Thu Aug 1 08:24:50 2013 +0100
Committer: Dan Haywood <da...@apache.org>
Committed: Thu Aug 1 08:24:50 2013 +0100
----------------------------------------------------------------------
.../progmodel/facets/MethodFinderUtils.java | 26 +++++++++++---------
1 file changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/6126bb1d/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/MethodFinderUtils.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/MethodFinderUtils.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/MethodFinderUtils.java
index f9e7c44..eda99e4 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/MethodFinderUtils.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/MethodFinderUtils.java
@@ -40,15 +40,23 @@ public final class MethodFinderUtils {
/**
* Returns a specific public methods that: have the specified prefix; have
- * the specified return type, or void, if canBeVoid is true; and has the
- * specified number of parameters. If the returnType is specified as null
- * then the return type is ignored.
+ * the specified return type (or some subtype), and has the
+ * specified number of parameters.
*
- * @param paramTypes
- * the set of parameters the method should have, if null then is
- * ignored
+ * <p>
+ * If the returnType is specified as null then the return type is ignored.
+ * If void.class is passed in, then searches for void methods.
+ *
+ * <p>
+ * If the parameter type array is null, is also not checked.
*/
- public static Method findMethod(final Class<?> type, final MethodScope methodScope, final String name, final Class<?> returnType, final Class<?>[] paramTypes) {
+ public static Method findMethod(
+ final Class<?> type,
+ final MethodScope methodScope,
+ final String name,
+ final Class<?> returnType,
+ final Class<?>[] paramTypes) {
+
Method method;
try {
method = type.getMethod(name, paramTypes);
@@ -60,7 +68,6 @@ public final class MethodFinderUtils {
final int modifiers = method.getModifiers();
- // check for public modifier
if (!Modifier.isPublic(modifiers)) {
return null;
}
@@ -70,17 +77,14 @@ public final class MethodFinderUtils {
return null;
}
- // check for name
if (!method.getName().equals(name)) {
return null;
}
- // check for return type
if (returnType != null && !returnType.isAssignableFrom(method.getReturnType())) {
return null;
}
- // check params (if required)
if (paramTypes != null) {
final Class<?>[] parameterTypes = method.getParameterTypes();
if (paramTypes.length != parameterTypes.length) {