lapisx.util
Class Reflect

java.lang.Object
  extended bylapisx.util.Reflect

public abstract class Reflect
extends Object

Handy reflection routines.


Constructor Summary
Reflect()
           
 
Method Summary
static Object callMethod(Object obj, String methodName, Class[] signature, Object[] args)
          Call a method of an object.
static Object callStaticMethod(String className, String methodName, Class[] signature, Object[] args)
          Call a static method of a class.
static Object getStaticField(String className, String fieldName)
          Fetch a static field from a class.
static Object newInstance(String className, Class[] signature, Object[] args)
          Create a new instance of a class by calling a constructor with arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Reflect

public Reflect()
Method Detail

newInstance

public static Object newInstance(String className,
                                 Class[] signature,
                                 Object[] args)
                          throws Exception
Create a new instance of a class by calling a constructor with arguments.

Throws:
Exception

callMethod

public static Object callMethod(Object obj,
                                String methodName,
                                Class[] signature,
                                Object[] args)
                         throws Exception
Call a method of an object.

Throws:
Exception

callStaticMethod

public static Object callStaticMethod(String className,
                                      String methodName,
                                      Class[] signature,
                                      Object[] args)
                               throws Exception
Call a static method of a class.

Throws:
Exception

getStaticField

public static Object getStaticField(String className,
                                    String fieldName)
                             throws Exception
Fetch a static field from a class.

Throws:
Exception