Package py4j.reflection
Class MethodInvoker
java.lang.Object
py4j.reflection.MethodInvoker
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMethodInvoker
(Constructor<?> constructor, TypeConverter[] converters, int cost) MethodInvoker
(Method method, TypeConverter[] converters, int cost) -
Method Summary
Modifier and TypeMethodDescriptionstatic 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<?>
int
getCost()
boolean
isVoid()
-
Field Details
-
INVALID_INVOKER_COST
public static final int INVALID_INVOKER_COST- See Also:
-
MAX_DISTANCE
public static final int MAX_DISTANCE- See Also:
-
INVALID_INVOKER
-
-
Constructor Details
-
MethodInvoker
-
MethodInvoker
-
-
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
-
buildInvoker
-
getConstructor
-
getConverters
-
getCost
public int getCost() -
getMethod
-
invoke
-
isVoid
public boolean isVoid()
-