Top Description Constructors Methods
org.jdom2.internal

public Class ReflectionConstructor

extends Object
Class Inheritance
Imports
java.lang.reflect.Constructor, .InvocationTargetException

Utility class that handles constructing a class using reflection, and a no-argument 'default' constructor.
Author
Rolf Lear

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static final <
The generic type of the returned value.
E
>
E

Returns:

an instantiated class
construct
(String
The class name of the instance to create.
classname
,
Class<E>
The return type of the created instance
targetclass
)

Construct a new instance of the named class, and ensure it is cast to the type specified as the targetclass.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ReflectionConstructorback to summary
public ReflectionConstructor()

Method Detail

constructback to summary
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.

Parameters
<E>
The generic type of the returned value.
classname:String

The class name of the instance to create.

targetclass:Class<E>

The return type of the created instance

Returns:E

an instantiated class

Exceptions
IllegalArgumentException:
if there is a problem locating the class instance.
IllegalStateException:
if there is a problem instantiating a class instance.