public class ReflectionConstructor
extends java.lang.Object
Constructor and Description |
---|
ReflectionConstructor() |
Modifier and Type | Method and Description |
---|---|
static <E> E |
construct(java.lang.String classname,
java.lang.Class<E> targetclass)
Construct a new instance of the named class, and ensure it is cast
to the type specified as the targetclass.
|
public static final <E> E construct(java.lang.String classname, java.lang.Class<E> targetclass)
E
- The generic type of the returned value.classname
- The class name of the instance to create.targetclass
- The return type of the created instancejava.lang.IllegalArgumentException
- if there is a problem locating the class instance.java.lang.IllegalStateException
- if there is a problem instantiating a class instance.Copyright © 2021 Jason Hunter, Brett McLaughlin. All Rights Reserved.