Class ReflectionMethods
- java.lang.Object
-
- com.datumbox.framework.common.utilities.ReflectionMethods
-
public class ReflectionMethods extends Object
The ReflectionMethods class contains a list of utility methods related to Reflection.- Author:
- Vasilis Vryniotis
-
-
Constructor Summary
Constructors Constructor Description ReflectionMethods()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MethodfindMethod(Object obj, String methodName, Object... params)Finds the public, protected, default or private method of the object with the provided name and parameters.static List<Field>getAllFields(List<Field> fields, Class<?> type)Gets all the fields recursively from all the parent classes.static ObjectinvokeMethod(Object obj, Method method, Object... params)Invokes a method on the object using reflection.static ObjectinvokeMethod(Object obj, String methodName, Object... params)Invokes a method on the object using reflection.
-
-
-
Method Detail
-
getAllFields
public static List<Field> getAllFields(List<Field> fields, Class<?> type)
Gets all the fields recursively from all the parent classes.- Parameters:
fields-type-- Returns:
-
findMethod
public static Method findMethod(Object obj, String methodName, Object... params)
Finds the public, protected, default or private method of the object with the provided name and parameters.- Parameters:
obj-methodName-params-- Returns:
-
invokeMethod
public static Object invokeMethod(Object obj, Method method, Object... params)
Invokes a method on the object using reflection.- Parameters:
obj-method-params-- Returns:
-
-