public static < T > T instantiateClass ( final Class < T > clazz , final Class < ? > [ ] parameterTypes , final Object [ ] parameterValues ) throws BeanInstantiationException { if ( clazz . isInterface ( ) ) { throw new BeanInstantiationException ( clazz , CLASS_IS_INTERFACE ) ; } try { Constructor < T > constructor = clazz . getConstructor ( parameterTypes ) ; T newInstance = constructor . newInstance ( parameterValues ) ; return newInstance ; } catch ( Exception e ) { throw new BeanInstantiationException ( clazz , NO_DEFAULT_CONSTRUCTOR_FOUND , e ) ; } }
Create and initialize a new instance of the given class by given parameterTypes and parameterValues .