org.apache.hivemind.util
Class ConstructorUtils

java.lang.Object
  extended by org.apache.hivemind.util.ConstructorUtils

public class ConstructorUtils
extends java.lang.Object

Static methods for invoking constructors.

Author:
Howard Lewis Ship

Method Summary
static java.util.List getConstructorsOfLength(java.lang.Class clazz, int length)
           
static java.lang.Object invoke(java.lang.reflect.Constructor c, java.lang.Object[] parameters)
           
static java.lang.Object invokeConstructor(java.lang.Class targetClass, java.lang.Object[] parameters)
          Searches for a constructor matching against the provided arguments.
static boolean isCompatible(java.lang.Class actualType, java.lang.Class parameterType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

invokeConstructor

public static java.lang.Object invokeConstructor(java.lang.Class targetClass,
                                                 java.lang.Object[] parameters)
Searches for a constructor matching against the provided arguments.

Parameters:
targetClass - the class to be instantiated
parameters - the parameters to pass to the constructor (may be null or empty)
Returns:
the new instance
Throws:
ApplicationRuntimeException - on any failure

isCompatible

public static boolean isCompatible(java.lang.Class actualType,
                                   java.lang.Class parameterType)

invoke

public static java.lang.Object invoke(java.lang.reflect.Constructor c,
                                      java.lang.Object[] parameters)

getConstructorsOfLength

public static java.util.List getConstructorsOfLength(java.lang.Class clazz,
                                                     int length)