public class ConstructorUtil
extends java.lang.Object
Constructor
related utility functions.Constructor and Description |
---|
ConstructorUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.reflect.Constructor |
getConstructor(java.lang.Class type,
java.lang.Class[] argTypes)
Returns a
Constructor for the given method signature, or null
if no such Constructor can be found. |
static java.lang.Object |
invokeConstructor(java.lang.Class type,
java.lang.Class[] argTypes,
java.lang.Object[] argValues)
Creates a new instance of the specified type
using a
Constructor described by the given parameter types
and values. |
public static java.lang.reflect.Constructor getConstructor(java.lang.Class type, java.lang.Class[] argTypes)
Constructor
for the given method signature, or null
if no such Constructor can be found.type
- the (non-null) type of Object
the returned Constructor
should createargTypes
- a non-null array of types describing the parameters to the Constructor
.Constructor
for the given method signature, or null
if no such Constructor can be found.invokeConstructor(java.lang.Class, java.lang.Class[], java.lang.Object[])
public static java.lang.Object invokeConstructor(java.lang.Class type, java.lang.Class[] argTypes, java.lang.Object[] argValues) throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
Constructor
described by the given parameter types
and values.type
- the type of Object
to be createdargTypes
- a non-null array of types describing the parameters to the Constructor
.argValues
- a non-null array containing the values of the parameters to the Constructor
.Constructor
described by the given parameter types
and values.java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException