invokeConstructor
public static Object invokeConstructor(Class clazz,
Object[] arguments)
throws IllegalAccessException,
NoSuchMethodException,
InvocationTargetException,
InstantiationException
Find and invoke constructor matching the argument number and types returning an instance
of given class.
- Parameters:
clazz
- is the class of instance to construct
arguments
- is the arguments for the constructor to match in number and type
- Returns:
- instance of class
- Throws:
IllegalAccessException
- thrown if no access to class
NoSuchMethodException
- thrown when the constructor is not found
InvocationTargetException
- thrown when the ctor throws and exception
InstantiationException
- thrown when the class cannot be loaded