Class ClassTools

  • All Implemented Interfaces:

    
    public class ClassTools
    
                        

    Utility methods for handling dynamic access to classes.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      ClassTools()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static Object construct(String className) Call no-args constructor for a class.
      static Object construct(String className, int parameter) Call a class constructor with an integer parameter
      static Object construct(String className, String parameter) Call a class constructor with an String parameter
      static void invoke(Object instance, String methodName) Invoke a public method on a class instance
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ClassTools

        ClassTools()
    • Method Detail

      • construct

         static Object construct(String className)

        Call no-args constructor for a class.

        Parameters:
        className - name of the class to be constructed
      • construct

         static Object construct(String className, int parameter)

        Call a class constructor with an integer parameter

        Parameters:
        className - name of the class to be constructed
        parameter - the value to be used in the constructor
      • construct

         static Object construct(String className, String parameter)

        Call a class constructor with an String parameter

        Parameters:
        className - the name of the class to construct
        parameter - to be used for the construction of the class instance
      • invoke

         static void invoke(Object instance, String methodName)

        Invoke a public method on a class instance

        Parameters:
        instance - object on which the method should be called
        methodName - name of the method to be called