Class ReflectionUtils


  • public class ReflectionUtils
    extends Object
    Reflection specific utility functions
    Author:
    markr
    • Constructor Detail

      • ReflectionUtils

        public ReflectionUtils()
    • Method Detail

      • getParameterTypes

        public static Class<?>[] getParameterTypes​(Object[] parameters)
        Method that constructs the parameter types that go with the passed in parameters.
        Parameters:
        parameters - the parameters
        Returns:
        parameter class types
      • createTypedInstance

        public static <T> T createTypedInstance​(String className,
                                                Object... constructorParameters)
                                         throws PlanItException
        delegates to createInstance(String, Object...) only casts result to type provided
        Type Parameters:
        T - type of the created instance
        Parameters:
        className - of the class to be instantiated
        constructorParameters - parameters for constructor
        Returns:
        created instance
        Throws:
        PlanItException - when error occurs during instantiation
      • createInstance

        public static Object createInstance​(String className,
                                            Object... constructorParameters)
                                     throws PlanItException
        Create an instance of given class name and provided constructor parameters
        Parameters:
        className - of the class to be instantiated
        constructorParameters - parameters for constructor
        Returns:
        created instance
        Throws:
        PlanItException - when error occurs during instantiation