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 ConstructorgetConstructor(Class type, Class[] argTypes) Returns aConstructorfor the given method signature, or null if no such Constructor can be found.static ObjectinvokeConstructor(Class type, Class[] argTypes, Object[] argValues) Creates a new instance of the specified type using aConstructordescribed by the given parameter types and values.
-
Constructor Details
-
ConstructorUtil
public ConstructorUtil()
-
-
Method Details
-
getConstructor
Returns aConstructorfor the given method signature, or null if no such Constructor can be found.- Parameters:
type- the (non-null) type ofObjectthe returnedConstructorshould createargTypes- a non-null array of types describing the parameters to theConstructor.- Returns:
- a
Constructorfor 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 aConstructordescribed by the given parameter types and values.- Parameters:
type- the type ofObjectto 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
Constructordescribed by the given parameter types and values. - Throws:
InstantiationExceptionIllegalAccessExceptionInvocationTargetException
-