code: def invoke_method(
      obj, object_type, method_name, args=None, arg_types=None
  ):
      env_clazz = load_java_class(object_type)
      method = env_clazz.getDeclaredMethod(
          method_name,
          to_jarray(
              get_gateway().jvm.Class,
              [
                  load_java_class(arg_type)
                  for arg_type in arg_types or []
              ],
          ),
      )
      method.setAccessible(True)
      return method.invoke(
          obj, to_jarray(get_gateway().jvm.Object, args or [])
      )
  
file_path: flink/flink-python/pyflink/util/java_utils.py
imports: from datetime import timedelta
  from py4j.java_gateway import JavaClass, get_java_class, JavaObject
  from py4j.protocol import Py4JJavaError
  from pyflink.java_gateway import get_gateway
label_desc: Use image node_id 9 for calling a global function with example usage: invoke_method(obj, object_type, method_name, args, arg_types) and returns: method