abstract class Klass
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <T> T |
newInstance(java.lang.Class<T> klass)
Create a new instance for the given
klass . |
public static <T> T newInstance(java.lang.Class<T> klass)
klass
. Runtime exceptions
thrown from the constructor are rethrown, all other exceptions
generated from the reflective call are wrapped into a
IllegalArgumentException
and rethrown.klass
- desired class to instantiatejava.lang.IllegalArgumentException
- if the instantiation failsjava.lang.RuntimeException
- if the constructor for klass
throws
a runtime exception