public class ReflectionConstructor extends Object
Constructor and Description |
---|
ReflectionConstructor() |
Modifier and Type | Method and Description |
---|---|
static <E> E |
construct(String classname,
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(String classname, 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 instanceIllegalArgumentException
- if there is a problem locating the class instance.IllegalStateException
- if there is a problem instantiating a class instance.Copyright ? 2015 Jason Hunter, Brett McLaughlin. All Rights Reserved.