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.
Modifier and Type | Field and Description |
---|---|
static MethodInvoker |
INVALID_INVOKER |
static int |
INVALID_INVOKER_COST |
static int |
MAX_DISTANCE |
Constructor and Description |
---|
MethodInvoker(java.lang.reflect.Constructor<?> constructor,
TypeConverter[] converters,
int cost) |
MethodInvoker(java.lang.reflect.Method method,
TypeConverter[] converters,
int cost) |
Modifier and Type | Method and Description |
---|---|
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.
|
static MethodInvoker |
buildInvoker(java.lang.reflect.Constructor<?> constructor,
java.lang.Class<?>[] arguments) |
static MethodInvoker |
buildInvoker(java.lang.reflect.Method method,
java.lang.Class<?>[] arguments) |
java.lang.reflect.Constructor<?> |
getConstructor() |
java.util.List<TypeConverter> |
getConverters() |
int |
getCost() |
java.lang.reflect.Method |
getMethod() |
java.lang.Object |
invoke(java.lang.Object obj,
java.lang.Object[] arguments) |
boolean |
isVoid() |
public static final int INVALID_INVOKER_COST
public static final int MAX_DISTANCE
public static final MethodInvoker INVALID_INVOKER
public MethodInvoker(java.lang.reflect.Constructor<?> constructor, TypeConverter[] converters, int cost)
public MethodInvoker(java.lang.reflect.Method method, TypeConverter[] converters, int cost)
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.
converters
- parameters
- arguments
- public static MethodInvoker buildInvoker(java.lang.reflect.Constructor<?> constructor, java.lang.Class<?>[] arguments)
public static MethodInvoker buildInvoker(java.lang.reflect.Method method, java.lang.Class<?>[] arguments)
public java.lang.reflect.Constructor<?> getConstructor()
public java.util.List<TypeConverter> getConverters()
public int getCost()
public java.lang.reflect.Method getMethod()
public java.lang.Object invoke(java.lang.Object obj, java.lang.Object[] arguments)
public boolean isVoid()