public class ReflectionUtils extends Object
Constructor and Description |
---|
ReflectionUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
callMethod(Object targetObject,
Class<?> declaredClass,
String methodName) |
static <T> T |
callMethod(Object targetObject,
Class<?> declaredClass,
String methodName,
List<Class<?>> parameterClass,
List<Object> parameters) |
static <T> T |
callMethod(Object targetObject,
Class<?> declaredClass,
String methodName,
Object[] parameters)
The utility method to call method with the specific name.
|
static Field |
getClassField(Class<?> declaredClass,
String fieldName) |
static <T> T |
getFieldValue(Object targetObject,
Class<?> declaredClass,
String fieldName) |
static <T> T |
getFieldValue(Object targetObject,
Field field) |
public static <T> T getFieldValue(Object targetObject, Class<?> declaredClass, String fieldName)
public static <T> T callMethod(Object targetObject, Class<?> declaredClass, String methodName)
public static <T> T callMethod(Object targetObject, Class<?> declaredClass, String methodName, List<Class<?>> parameterClass, List<Object> parameters)
public static <T> T callMethod(Object targetObject, Class<?> declaredClass, String methodName, Object[] parameters)
Note that this method is added only for bypassing the existing bug in Py4j. It doesn't validate the classes of parameters so it can only deal with the classes that have only one method with the specific name.
TODO: Remove this method after the Py4j bug is fixed.
Copyright © 2019–2023 The Apache Software Foundation. All rights reserved.