Class MethodInvoker


  • public class MethodInvoker
    extends java.lang.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.

    • Constructor Detail

      • MethodInvoker

        public MethodInvoker​(java.lang.reflect.Constructor<?> constructor,
                             TypeConverter[] converters,
                             int cost)
      • MethodInvoker

        public MethodInvoker​(java.lang.reflect.Method method,
                             TypeConverter[] converters,
                             int cost)
    • Method Detail

      • buildConverters

        public static int buildConverters​(java.util.List<TypeConverter> converters,
                                          java.lang.Class<?>[] parameters,
                                          java.lang.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​(java.lang.reflect.Constructor<?> constructor,
                                                 java.lang.Class<?>[] arguments)
      • buildInvoker

        public static MethodInvoker buildInvoker​(java.lang.reflect.Method method,
                                                 java.lang.Class<?>[] arguments)
      • getConstructor

        public java.lang.reflect.Constructor<?> getConstructor()
      • getConverters

        public java.util.List<TypeConverter> getConverters()
      • getCost

        public int getCost()
      • getMethod

        public java.lang.reflect.Method getMethod()
      • invoke

        public java.lang.Object invoke​(java.lang.Object obj,
                                       java.lang.Object[] arguments)
      • isVoid

        public boolean isVoid()