lindong28 commented on code in PR #235:
URL: https://github.com/apache/flink-ml/pull/235#discussion_r1178571198
##########
flink-ml-iteration/src/main/java/org/apache/flink/iteration/utils/ReflectionUtils.java:
##########
@@ -80,4 +83,55 @@ public static <T> T callMethod(
"Failed to get method" + methodName + " from " +
targetObject, e);
}
}
+
+ /**
+ * The utility method to call method with the specific name and parameters.
+ *
+ * <p>Note that this method is added only for bypassing the existing bug
in Py4j. It doesn't
+ * validate the classes of parameters so it can only deal with the classes
that have only one
+ * method with the specific name.
+ *
+ * <p>TODO Remove this method after the Py4j bug is fixed.
+ */
+ @SuppressWarnings("unchecked")
+ public static <T> T callMethodByName(
+ Object targetObject, Class<?> declaredClass, String methodName,
Object[] parameters) {
+ List<Method> methods = new ArrayList<>();
+ for (Method m : declaredClass.getMethods()) {
Review Comment:
Would it be simpler to locate the method by calling `Class#getMethod(String
name, Class<?>... parameterTypes)`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]