org.dbforms.util
Class ReflectionUtil

java.lang.Object
  extended by org.dbforms.util.ReflectionUtil

public class ReflectionUtil
extends Object

ReflectionUtil class

Author:
Luca Fossato

Constructor Summary
ReflectionUtil()
           
 
Method Summary
static Object invoke(String className, String methodName, Class[] argsTypes, Object[] args)
          Invokes the underlying method represented by this Method object, on the specified object with the specified parameters.
static Object newInstance(Class clazz, Class[] constructorArgsTypes, Object[] constructorArgs)
          Return the object having the input class name, instanced with the constructor having the constructorArgsTypes arguments.
static Object newInstance(String className)
          Return the object having the input class name
static Object newInstance(String className, Class[] constructorArgsTypes, Object[] constructorArgs)
          Return the object having the input class name, instanced with the constructor having the constructorArgsTypes arguments.
static void reflectClass(String name, OutputStream os)
          Reflect the input class state.
static void reflectClass(String name, Writer w)
          Reflect the input class state.
static void reflectObject(Object o, OutputStream os)
          Reflect the input object state.
static void reflectObject(Object o, Writer w)
          Reflect the input object state.
static String toString(Object o)
          Get the String representation of the input object
static String toString(String c)
          Get the String representation of the class having the input full qualified name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionUtil

public ReflectionUtil()
Method Detail

invoke

public static Object invoke(String className,
                            String methodName,
                            Class[] argsTypes,
                            Object[] args)
                     throws Exception
Invokes the underlying method represented by this Method object, on the specified object with the specified parameters.
Individual parameters are automatically unwrapped to match primitive formal parameters, and both primitive and reference parameters are subject to widening conversions as necessary.
The value returned by the underlying method is automatically wrapped in an object if it has a primitive type.

Parameters:
className - the object class name
methodName - the arguments classes for the object method
argsTypes - the arguments values for the object constructor
args - DOCUMENT ME!
Returns:
If the method completes normally, the value it returns is returned to the caller of invoke; if the value has a primitive type, it is first appropriately wrapped in an object. If the underlying method return type is void, the invocation returns null.
Throws:
Exception - if any error occurs

newInstance

public static Object newInstance(String className)
                          throws Exception
Return the object having the input class name

Parameters:
className - the object class name
Returns:
the instanced object
Throws:
Exception - if any error occurs

newInstance

public static Object newInstance(String className,
                                 Class[] constructorArgsTypes,
                                 Object[] constructorArgs)
                          throws Exception
Return the object having the input class name, instanced with the constructor having the constructorArgsTypes arguments.

Parameters:
className - the object class name
constructorArgsTypes - the object constructor arguments classes
constructorArgs - the object constructor arguments values
Returns:
the instanced object
Throws:
Exception - if any error occurs

newInstance

public static Object newInstance(Class clazz,
                                 Class[] constructorArgsTypes,
                                 Object[] constructorArgs)
                          throws Exception
Return the object having the input class name, instanced with the constructor having the constructorArgsTypes arguments.

Parameters:
clazz - the object class name
constructorArgsTypes - the object constructor arguments classes
constructorArgs - the object constructor arguments values
Returns:
the instanced object
Throws:
Exception - if any error occurs

reflectClass

public static void reflectClass(String name,
                                OutputStream os)
Reflect the input class state.

Parameters:
name - Description of the Parameter
os - Description of the Parameter

reflectClass

public static void reflectClass(String name,
                                Writer w)
Reflect the input class state.

Parameters:
name - Description of the Parameter
w - Description of the Parameter

reflectObject

public static void reflectObject(Object o,
                                 OutputStream os)
Reflect the input object state.

Parameters:
o - Description of the Parameter
os - Description of the Parameter

reflectObject

public static void reflectObject(Object o,
                                 Writer w)
Reflect the input object state.

Parameters:
o - Description of the Parameter
w - Description of the Parameter

toString

public static String toString(Object o)
Get the String representation of the input object

Parameters:
o - the object to introspect
Returns:
the String representation of the input object

toString

public static String toString(String c)
Get the String representation of the class having the input full qualified name.

Parameters:
c - the full qualified name of the class to introspect
Returns:
the String representation of the input object


Copyright © 2002-2006 DbForms. All Rights Reserved.