Java Reflection Constructor Invoke invokeConstructor(Class clazz, Class[] argTypes, Object[] args)

Here you can find the source of invokeConstructor(Class clazz, Class[] argTypes, Object[] args)

Description

invoke Constructor

License

Apache License

Declaration

public static <T> T invokeConstructor(Class<T> clazz, Class<?>[] argTypes, Object[] args)
        throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException,
        IllegalArgumentException, InvocationTargetException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.lang.reflect.Constructor;

import java.lang.reflect.InvocationTargetException;

public class Main {

    public static <T> T invokeConstructor(Class<T> clazz, Class<?>[] argTypes, Object[] args)
            throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException,
            IllegalArgumentException, InvocationTargetException {
        Constructor<T> constructor = clazz.getConstructor(argTypes);
        return constructor.newInstance(args);
    }//from  w ww  .  java  2 s  . co m
}

Related

  1. invoke(Constructor constructor, Object... args)
  2. invoke(Constructor constructor, Object... args)
  3. invokeConstructor(Class clazz, Class[] paramTypes, Object[] params)
  4. invokeConstructor(Class clazz, Object... parameters)
  5. invokeConstructor(Class objectClass, Class[] classes, Object... params)
  6. invokeConstructor(Class cls)
  7. invokeConstructor(Class type, Object value)
  8. invokeConstructor(Constructor constructor, Object... arguments)
  9. invokeConstructor(Constructor constructor, Object... parameters)