|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.osesb.utilities.language.ClassUtilities
public final class ClassUtilities
This Class contains utilities for handling files.
| Field Summary | |
|---|---|
protected static org.apache.commons.logging.Log |
log
The logging implementation for this class. |
| Constructor Summary | |
|---|---|
ClassUtilities()
|
|
| Method Summary | |
|---|---|
static java.lang.Class |
getApplicationAncestor(java.lang.Class theClass)
Returns the ancestor of the specified Class immediately below java.lang.Object. |
static java.lang.String |
getApplicationAncestor(java.lang.String className)
Returns the ancestor of the specified Class immediately below java.lang.Object. |
static java.lang.Class |
getClass(java.lang.String className)
Returns the specified Class. |
static java.lang.reflect.Constructor |
getConstructor(java.lang.String theClassName,
java.lang.Class[] constructorSignature)
Returns the Constructor with the specified signature for the named Class. |
static java.lang.reflect.Constructor |
getConstructor(java.lang.String theClassName,
java.lang.Class[] constructorSignature,
java.lang.Class ancestorClass,
java.lang.Class interfaceClass)
Returns the Constructor with the specified signature for the named Class with optional checks to insure that the Class extends another Class or implements an Interface. |
static java.lang.reflect.Constructor[] |
getConstructors(java.lang.String theClassName)
Gets an array of Constructor(s) for the named Class. |
static java.lang.reflect.Constructor[] |
getConstructors(java.lang.String theClassName,
java.lang.Class ancestorClass,
java.lang.Class interfaceClass)
Gets an array of Constructor(s) for the named Class with optional checks to insure that the Class extends another Class or implements an Interface. |
static java.lang.String |
getPackageName(java.lang.Class theClass)
returns the package name for the specified Class. |
static boolean |
implementsInterface(java.lang.Class theClass,
java.lang.Class theInterface)
Checks of a Class implements the specified interface. |
static boolean |
implementsInterface(java.lang.String theClassName,
java.lang.String theInterfaceName)
Checks of a Class implements the specified interface. |
static boolean |
isdescendantOf(java.lang.Class descendantClass,
java.lang.Class ancestorClass)
Checks of one Class is a descendant of another Class. |
static boolean |
isdescendantOf(java.lang.String descendantClassName,
java.lang.Class ancestorClass)
Checks of one Class is a descendant of another Class. |
static boolean |
isdescendantOf(java.lang.String descendantClassName,
java.lang.String ancestorClassName)
Checks of one Class is a descendant of another Class. |
static void |
main(java.lang.String[] args)
Main method for testing and sandboxing. |
static java.lang.Object |
newInstance(java.lang.String theClassName,
java.lang.Object[] constructorArguments)
Create a newInstance of the specified Class using the Constructor signature that matches the constructorArguments. |
static java.lang.Object |
newInstance(java.lang.String theClassName,
java.lang.Object[] constructorArguments,
java.lang.Class[] constructorSignature)
Create a newInstance of the specified Class using the Constructor signature that matches the constructorArguments. |
static java.lang.Object |
newInstance(java.lang.String theClassName,
java.lang.Object[] constructorArguments,
java.lang.Class[] constructorSignature,
java.lang.Class ancestorClass,
java.lang.Class interfaceClass)
Create a newInstance of the specified Class using the Constructor specified by constructorSignature, passing it constructorArguments with optional checks to insure that the Class extends another Class or implements an Interface. |
static java.lang.Object |
newInstance(java.lang.String theClassName,
java.lang.Object[] constructorArguments,
java.lang.Class ancestorClass,
java.lang.Class interfaceClass)
Create a newInstance of the specified Class using the Constructor signature that matches the constructor Arguments with optional checks to insure that the Class extends another Class or implements an Interface. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static org.apache.commons.logging.Log log
| Constructor Detail |
|---|
public ClassUtilities()
| Method Detail |
|---|
public static java.lang.Class getClass(java.lang.String className)
throws java.lang.Exception
className - The name of the Class to get.
java.lang.Exception - if the Class cannot be found.public static java.lang.String getPackageName(java.lang.Class theClass)
theClass - The Class to get the package name of.
public static java.lang.String getApplicationAncestor(java.lang.String className)
className - The name of the Class to get the ancestor of.
public static java.lang.Class getApplicationAncestor(java.lang.Class theClass)
theClass - The Class to get the ancestor of.
public static boolean isdescendantOf(java.lang.String descendantClassName,
java.lang.Class ancestorClass)
descendantClassName - The name of the Class to check.ancestorClass - The Class to check against.
public static boolean isdescendantOf(java.lang.String descendantClassName,
java.lang.String ancestorClassName)
descendantClassName - The name of the Class to check.ancestorClassName - The name of the Class to check against.
public static boolean isdescendantOf(java.lang.Class descendantClass,
java.lang.Class ancestorClass)
descendantClass - The Class to check.ancestorClass - The Class to check against.
public static boolean implementsInterface(java.lang.String theClassName,
java.lang.String theInterfaceName)
theClassName - The name of the Class to check.theInterfaceName - The name of the Interface Class to check against.
public static boolean implementsInterface(java.lang.Class theClass,
java.lang.Class theInterface)
theClass - The Class to check.theInterface - The Interface Class to check against.
public static java.lang.Object newInstance(java.lang.String theClassName,
java.lang.Object[] constructorArguments)
throws java.lang.Exception
theClassName - The name of the Class to get a newInstance of.constructorArguments - The arguments for the Constructor to use as an Object[].
If omitted, a no argument constructor is used.
java.lang.Exception - if the Class cannot be instantiated.
public static java.lang.Object newInstance(java.lang.String theClassName,
java.lang.Object[] constructorArguments,
java.lang.Class[] constructorSignature)
throws java.lang.Exception
theClassName - The name of the Class to get a newInstance of.constructorArguments - The arguments for the Constructor to use as an Object[].
If omitted, a no argument constructor is used.constructorSignature - The parameter types for the Constructor as a Class[].
If omitted, the constructorSignature is derived from
the constructorArguments.
java.lang.Exception - if the Class cannot be instantiated.
public static java.lang.Object newInstance(java.lang.String theClassName,
java.lang.Object[] constructorArguments,
java.lang.Class ancestorClass,
java.lang.Class interfaceClass)
throws java.lang.Exception
theClassName - The name of the Class to get a newInstance of.constructorArguments - The arguments for the Constructor to use as an Object[].
If omitted, a no argument constructor is used.ancestorClass - If specified, checks that theClass is
a descendant of ancestorClass.interfaceClass - If specified, checks that theClass
implements interfaceClass.
java.lang.Exception - if the Class cannot be instantiated.
public static java.lang.Object newInstance(java.lang.String theClassName,
java.lang.Object[] constructorArguments,
java.lang.Class[] constructorSignature,
java.lang.Class ancestorClass,
java.lang.Class interfaceClass)
throws java.lang.Exception
theClassName - The name of the Class to get a newInstance of.constructorArguments - The arguments for the Constructor to use as an Object[].
If omitted, a no argument constructor is used.constructorSignature - The parameter types for the Constructor as a Class[].
If omitted, the constructorSignature is derived from
the constructorArguments.ancestorClass - If specified, checks that theClass is
a descendant of ancestorClass.interfaceClass - If specified, checks that theClass
implements interfaceClass.
java.lang.Exception - if the Class cannot be instantiated
or if ancestor or interface implementation tests fail.
public static java.lang.reflect.Constructor getConstructor(java.lang.String theClassName,
java.lang.Class[] constructorSignature)
throws java.lang.Exception
theClassName - The name of the Class to get a the Constructor for.constructorSignature - The constructor signature as a Class[].
If omitted, this method looks for a no-argument
constructor.
java.lang.Exception - if the Class cannot be loaded or if the constructor
cannot be found.
public static java.lang.reflect.Constructor getConstructor(java.lang.String theClassName,
java.lang.Class[] constructorSignature,
java.lang.Class ancestorClass,
java.lang.Class interfaceClass)
throws java.lang.Exception
theClassName - The name of the Class to get the Constructor for.constructorSignature - The constructor signature as a Class[].
If omitted, this method looks for a no-argument
constructor.ancestorClass - If specified, checks that theClass is
a descendant of ancestorClass.interfaceClass - If specified, checks that theClass
implements interfaceClass.
java.lang.Exception - if the Class cannot be loaded, the constructor
cannot be found, or if ancestor or interface implementation tests fail.
public static java.lang.reflect.Constructor[] getConstructors(java.lang.String theClassName)
throws java.lang.Exception
theClassName - The name of the Class to get the Constructor(s) for.
java.lang.Exception - if the Class cannot be loaded, the constructor
cannot be found, or if ancestor or interface implementation tests fail.
public static java.lang.reflect.Constructor[] getConstructors(java.lang.String theClassName,
java.lang.Class ancestorClass,
java.lang.Class interfaceClass)
throws java.lang.Exception
theClassName - The name of the Class to get the Constructor(s) for.ancestorClass - If specified, checks that theClass is
a descendant of another ancestorClass.interfaceClass - If specified, checks that theClass
implements interfaceClass.
java.lang.Exception - if the Class cannot be loaded, the constructor
cannot be found, or if ancestor or interface implementation tests fail.public static void main(java.lang.String[] args)
args - commandline arguments
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||