Java Class New Instance newInstance(Constructor ctor, Object... params)

Here you can find the source of newInstance(Constructor ctor, Object... params)

Description

Checked exceptions are LAME.

License

Open Source License

Declaration

public static <T> T newInstance(Constructor<T> ctor, Object... params) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.lang.reflect.Constructor;

import java.lang.reflect.InvocationTargetException;

public class Main {
    /** Checked exceptions are LAME. */
    public static <T> T newInstance(Constructor<T> ctor, Object... params) {
        try {/*from  w  w w .j av  a  2  s . c o  m*/
            return ctor.newInstance(params);
        } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. newInstance(Class type, Object... args)
  2. newInstance(Class type, Object... params)
  3. newInstance(Constructor c, List parameters)
  4. newInstance(Constructor constructor, Object... args)
  5. newInstance(Constructor constructor, Object... arguments)
  6. newInstance(Field field)
  7. newInstance(final Class clazz)
  8. newInstance(final Class clazz, final Object[] parameters)
  9. newInstance(final Class arrayClass, final int length)

  10. HOME | Copyright © www.java2s.com 2016