Package org.jdom.internal
Class ReflectionConstructor
- java.lang.Object
-
- org.jdom.internal.ReflectionConstructor
-
public class ReflectionConstructor extends Object
Utility class that handles constructing a class using reflection, and a no-argument 'default' constructor.
-
-
Constructor Summary
Constructors Constructor Description ReflectionConstructor()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <E> Econstruct(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.
-
-
-
Method Detail
-
construct
public static final <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.- Type Parameters:
E- The generic type of the returned value.- Parameters:
classname- The class name of the instance to create.targetclass- The return type of the created instance- Returns:
- an instantiated class
- Throws:
IllegalArgumentException- if there is a problem locating the class instance.IllegalStateException- if there is a problem instantiating a class instance.
-
-