org.aitools.programd.util
Class ClassUtils

java.lang.Object
  extended by org.aitools.programd.util.ClassUtils

public class ClassUtils
extends java.lang.Object

Contains utilities related to manipulating classes.

Since:
4.5
Author:
Noel Bush

Constructor Summary
ClassUtils()
           
 
Method Summary
static
<T> T
getNewInstance(java.lang.Class<T> theClass, java.lang.String description, java.lang.Object... constructorArgs)
          Returns an instance of the given class, instantiated using a constructor that takes the arguments given.
static
<T> T
getSubclassInstance(java.lang.Class<T> baseType, java.lang.String classname, java.lang.String description, java.lang.Object... constructorArgs)
          Returns the class which is a subclass of T, instantiated using a constructor that takes the arguments given.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassUtils

public ClassUtils()
Method Detail

getSubclassInstance

public static <T> T getSubclassInstance(java.lang.Class<T> baseType,
                                        java.lang.String classname,
                                        java.lang.String description,
                                        java.lang.Object... constructorArgs)
Returns the class which is a subclass of T, instantiated using a constructor that takes the arguments given.

Type Parameters:
T - the class of which the instantiated class must be a subclass
Parameters:
classname - the classname to instantiate
baseType - the base class type
description - a short (one word or so) description of the desired class
constructorArgs - the arguments to the constructor (actual arguments, not types)
Returns:
the desired class

getNewInstance

public static <T> T getNewInstance(java.lang.Class<T> theClass,
                                   java.lang.String description,
                                   java.lang.Object... constructorArgs)
Returns an instance of the given class, instantiated using a constructor that takes the arguments given.

Type Parameters:
T - the type of the class
Parameters:
theClass - the class to instantiate
description - a short (one word or so) description of the desired class
constructorArgs - the arguments to the constructor (actual arguments, not types)
Returns:
the desired class