Class ReflectionMethods


  • public class ReflectionMethods
    extends Object
    The ReflectionMethods class contains a list of utility methods related to Reflection.
    Author:
    Vasilis Vryniotis
    • Constructor Detail

      • ReflectionMethods

        public ReflectionMethods()
    • 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:
      • invokeMethod

        public static Object invokeMethod​(Object obj,
                                          String methodName,
                                          Object... params)
        Invokes a method on the object using reflection.
        Parameters:
        obj -
        methodName -
        params -
        Returns: