com.generationjava.lang
Class ClassW

java.lang.Object
  extended bycom.generationjava.lang.ClassW

public final class ClassW
extends Object

A set of static utilities for use with Classes.

Author:
bayard@generationjava.com

Constructor Summary
ClassW()
           
 
Method Summary
static void callMain(Class clss, String[] args)
           
static void callMain(String[] args)
           
static void callMain(String classname, String[] args)
           
static Object callStatic(Class clss, String methodName, Class[] types, Object[] args)
           
static Object callStatic(String classname, String methodName, Class[] types, Object[] args)
          Runs a static method on a class.
static boolean classExists(String classname)
          Is this Class in the CLASSPATH
static Object createObject(Class clss)
          Create an object from a class.
static Object createObject(String classname)
          Create an object from the classname.
static Class getClass(String classname)
          Get the Class object for a classname.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassW

public ClassW()
Method Detail

createObject

public static Object createObject(String classname)
Create an object from the classname. Must have an empty constructor.

Parameters:
classname - String name of the class
Returns:
Object instance of the class or null

createObject

public static Object createObject(Class clss)
Create an object from a class.

Parameters:
clss - Class object to instantiate
Returns:
Object instance of the class or null

classExists

public static boolean classExists(String classname)
Is this Class in the CLASSPATH

Parameters:
classname - String of the class
Returns:
boolean exists or not.

getClass

public static Class getClass(String classname)
Get the Class object for a classname.

Parameters:
classname - String of the class
Returns:
Class instance for the class.

callMain

public static void callMain(String[] args)

callMain

public static void callMain(String classname,
                            String[] args)

callMain

public static void callMain(Class clss,
                            String[] args)

callStatic

public static Object callStatic(String classname,
                                String methodName,
                                Class[] types,
                                Object[] args)
Runs a static method on a class.

Parameters:
classname - String name of class to invoke on.
methodName - String name of method to call.
args - Object[] arguments to method.

callStatic

public static Object callStatic(Class clss,
                                String methodName,
                                Class[] types,
                                Object[] args)


Copyright © 2000-2005 OSJava. All Rights Reserved.