Class MethodInvoker

java.lang.Object
py4j.reflection.MethodInvoker

public class MethodInvoker extends Object

A MethodInvoker translates a call made in a Python Program into a call to a Java method.

A MethodInvoker is tailored to a particular set of actual parameters and indicates how far the calling context is from the method signature.

For example, a call to method1(String) from Python can be translated to a call to method1(char) in Java, with a cost of 1.

Author:
Barthelemy Dagenais
  • Field Details

  • Constructor Details

  • Method Details

    • buildConverters

      public static int buildConverters(List<TypeConverter> converters, Class<?>[] parameters, Class<?>[] arguments)

      Builds a list of converters used to convert the arguments into the parameters.

      Parameters:
      converters -
      parameters -
      arguments -
      Returns:
    • buildInvoker

      public static MethodInvoker buildInvoker(Constructor<?> constructor, Class<?>[] arguments)
    • buildInvoker

      public static MethodInvoker buildInvoker(Method method, Class<?>[] arguments)
    • getConstructor

      public Constructor<?> getConstructor()
    • getConverters

      public List<TypeConverter> getConverters()
    • getCost

      public int getCost()
    • getMethod

      public Method getMethod()
    • invoke

      public Object invoke(Object obj, Object[] arguments)
    • isVoid

      public boolean isVoid()