JDOM
0.0.5-BETA

org.jdom2.util
Class ReflectionConstructor

java.lang.Object
  extended by org.jdom2.util.ReflectionConstructor

public class ReflectionConstructor
extends java.lang.Object

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

Author:
Rolf Lear

Constructor Summary
ReflectionConstructor()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionConstructor

public ReflectionConstructor()
Method Detail

construct

public static final <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.

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:
java.lang.IllegalArgumentException - if there is a problem locating the class instance.
java.lang.IllegalStateException - if there is a problem instantiating a class instance.

JDOM
0.0.5-BETA

Copyright � 2012 Jason Hunter, Brett McLaughlin. All Rights Reserved.