Java Class New Instance newInstance(Class beanClass)

Here you can find the source of newInstance(Class beanClass)

Description

new Instance

License

Apache License

Declaration

private static <T> T newInstance(Class<T> beanClass) 

Method Source Code

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

public class Main {
    private static <T> T newInstance(Class<T> beanClass) {
        T instance = null;/*  w w  w  .  ja  v  a2 s.com*/
        try {
            instance = beanClass.newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            throw new IllegalArgumentException("create instance of " + beanClass.getSimpleName() + "failed. WTF?",
                    e);
        }
        return instance;
    }
}

Related

  1. newInstance(Class entity)
  2. newInstance(Class theClass, Class expected)
  3. newInstance(Class interfaceDefinition, String className, ClassLoader classLoader)
  4. newInstance(Class aClass, Object... args)
  5. newInstance(Class arrayComponentClass, T value)
  6. newInstance(Class c)
  7. newInstance(Class c)
  8. newInstance(Class c, Class[] argTypes, Object[] args)
  9. newInstance(Class cl)