Skip to content
Browse files

[#1091] add invokeChildOrStatic

  • Loading branch information...
1 parent b15323b commit d286e9f55edf82d12bebd3132ad292fa01acc6d5 Georg Engel committed Sep 1, 2011
Showing with 17 additions and 1 deletion.
  1. +17 −1 framework/src/play/utils/Java.java
View
18 framework/src/play/utils/Java.java
@@ -165,6 +165,22 @@ public static Object invokeStaticOrParent(Class<?> clazz, String method, Object.
throw new NoSuchMethodException(method);
}
+ public static Object invokeChildOrStatic(Class<?> clazz, String method, Object... args) throws Exception {
+
+ Class invokedClass = null;
+ List<Class> assignableClasses = Play.classloader.getAssignableClasses(clazz);
+ if(assignableClasses.size() == 0)
+ {
+ invokedClass = clazz;
+ }
+ else
+ {
+ invokedClass = assignableClasses.get(0);
+ }
+
+ return Java.invokeStaticOrParent(invokedClass, method, args);
+ }
+
public static Object invokeStatic(Method method, Map<String, String[]> args) throws Exception {
return method.invoke(null, prepareArgs(method, args));
}
@@ -523,4 +539,4 @@ public int hashCode() {
}
-}
+}

0 comments on commit d286e9f

Please sign in to comment.
Something went wrong with that request. Please try again.