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.
Modifier and Type | Field and Description |
---|---|
static MethodInvoker |
INVALID_INVOKER |
static int |
INVALID_INVOKER_COST |
static int |
MAX_DISTANCE |
Constructor and Description |
---|
MethodInvoker(Constructor<?> constructor,
TypeConverter[] converters,
int cost) |
MethodInvoker(Method method,
TypeConverter[] converters,
int cost) |
Modifier and Type | Method and Description |
---|---|
static int |
buildConverters(List<TypeConverter> converters,
Class<?>[] parameters,
Class<?>[] arguments)
Builds a list of converters used to convert the arguments into the parameters.
|
static MethodInvoker |
buildInvoker(Constructor<?> constructor,
Class<?>[] arguments) |
static MethodInvoker |
buildInvoker(Method method,
Class<?>[] arguments) |
Constructor<?> |
getConstructor() |
List<TypeConverter> |
getConverters() |
int |
getCost() |
Method |
getMethod() |
Object |
invoke(Object obj,
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(Constructor<?> constructor, TypeConverter[] converters, int cost)
public MethodInvoker(Method method, TypeConverter[] converters, int cost)
public static int buildConverters(List<TypeConverter> converters, Class<?>[] parameters, Class<?>[] arguments)
Builds a list of converters used to convert the arguments into the parameters.
converters
- parameters
- arguments
- public static MethodInvoker buildInvoker(Constructor<?> constructor, Class<?>[] arguments)
public static MethodInvoker buildInvoker(Method method, Class<?>[] arguments)
public Constructor<?> getConstructor()
public List<TypeConverter> getConverters()
public int getCost()
public Method getMethod()
public boolean isVoid()
Copyright © 2025. All rights reserved.