Package org.apache.commons.jocl
Class ConstructorUtil
java.lang.Object
org.apache.commons.jocl.ConstructorUtil
Miscellaneous
Constructor
related utility functions.- Version:
- $Revision: 479137 $ $Date: 2006-11-25 10:51:48 -0500 (Sat, 25 Nov 2006) $
- Author:
- Rodney Waldhoff
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Constructor
getConstructor
(Class type, Class[] argTypes) Returns aConstructor
for the given method signature, or null if no such Constructor can be found.static Object
invokeConstructor
(Class type, Class[] argTypes, Object[] argValues) Creates a new instance of the specified type using aConstructor
described by the given parameter types and values.
-
Constructor Details
-
ConstructorUtil
public ConstructorUtil()
-
-
Method Details
-
getConstructor
Returns aConstructor
for the given method signature, or null if no such Constructor can be found.- Parameters:
type
- the (non-null) type ofObject
the returnedConstructor
should createargTypes
- a non-null array of types describing the parameters to theConstructor
.- Returns:
- a
Constructor
for the given method signature, or null if no such Constructor can be found. - See Also:
-
invokeConstructor
public static Object invokeConstructor(Class type, Class[] argTypes, Object[] argValues) throws InstantiationException, IllegalAccessException, InvocationTargetException Creates a new instance of the specified type using aConstructor
described by the given parameter types and values.- Parameters:
type
- the type ofObject
to be createdargTypes
- a non-null array of types describing the parameters to theConstructor
.argValues
- a non-null array containing the values of the parameters to theConstructor
.- Returns:
- a new instance of the specified type
using a
Constructor
described by the given parameter types and values. - Throws:
InstantiationException
IllegalAccessException
InvocationTargetException
-