com.livis.flabes.util
Class MethodUtils

java.lang.Object
  |
  +--com.livis.flabes.util.MethodUtils

public class MethodUtils
extends java.lang.Object


Method Summary
static java.lang.Object invokeCatching(java.lang.Class cls, java.lang.Object object, java.lang.String methodName)
          Get and invoke a method by calling Class.getMethod(java.lang.String, java.lang.Class[])/Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions.
static java.lang.Object invokeCatching(java.lang.Class cls, java.lang.Object object, java.lang.String methodName, java.lang.Class[] paramTypes, java.lang.Object[] args)
          Get and invoke a method by calling Class.getMethod(java.lang.String, java.lang.Class[])/Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions.
static java.lang.Object invokeCatching(java.lang.Class cls, java.lang.Object object, java.lang.String methodName, java.lang.Class[] paramTypes, java.lang.Object[] args, java.io.PrintWriter out)
          Get and invoke a method by calling Class.getMethod(java.lang.String, java.lang.Class[])/Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions.
static java.lang.Object invokeCatching(java.lang.Class cls, java.lang.Object object, java.lang.String methodName, java.io.PrintWriter out)
          Get and invoke a method by calling Class.getMethod(java.lang.String, java.lang.Class[])/Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions.
static java.lang.Object invokeCatching(java.lang.Object object, java.lang.reflect.Method method)
          Invoke a method by calling Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions.
static java.lang.Object invokeCatching(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object[] args)
          Invoke a method by calling Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions.
static java.lang.Object invokeCatching(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object[] args, java.io.PrintWriter out)
          Invoke a method by calling Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions.
static java.lang.Object invokeCatching(java.lang.Object object, java.lang.reflect.Method method, java.io.PrintWriter out)
          Invoke a method by calling Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions.
static java.lang.Object invokeCatching(java.lang.Object object, java.lang.String methodName)
          Get and invoke a method by calling Class.getMethod(java.lang.String, java.lang.Class[])/Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions.
static java.lang.Object invokeCatching(java.lang.Object object, java.lang.String methodName, java.lang.Class[] paramTypes, java.lang.Object[] args)
          Get and invoke a method by calling Class.getMethod(java.lang.String, java.lang.Class[])/Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions.
static java.lang.Object invokeCatching(java.lang.Object object, java.lang.String methodName, java.lang.Class[] paramTypes, java.lang.Object[] args, java.io.PrintWriter out)
          Get and invoke a method by calling Class.getMethod(java.lang.String, java.lang.Class[])/Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions.
static java.lang.Object invokeCatching(java.lang.Object object, java.lang.String methodName, java.lang.Object[] args)
          Get and invoke a method by calling Class.getMethod(java.lang.String, java.lang.Class[])/Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions.
static java.lang.Object invokeCatching(java.lang.Object object, java.lang.String methodName, java.io.PrintWriter out)
          Get and invoke a method by calling Class.getMethod(java.lang.String, java.lang.Class[])/Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions.
static java.lang.reflect.Method read(java.io.ObjectInputStream in)
          De-serialize a Method object.
static void write(java.io.ObjectOutputStream out, java.lang.reflect.Method method)
          Serialize a Method object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

invokeCatching

public static java.lang.Object invokeCatching(java.lang.Object object,
                                              java.lang.reflect.Method method,
                                              java.lang.Object[] args,
                                              java.io.PrintWriter out)
Invoke a method by calling Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions. The stack trace of a caught exception is printed.
Parameters:
object - object to invoke the method on. If the method is static, object is ignord and may be null.
method - method to invoke.
args - actual parameters.
out - destination to print a caught exception to. No exceptions are printed if out is null.
See Also:
Method.invoke(java.lang.Object, java.lang.Object[])

invokeCatching

public static java.lang.Object invokeCatching(java.lang.Object object,
                                              java.lang.reflect.Method method,
                                              java.lang.Object[] args)
Invoke a method by calling Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions. Like . The stack trace of a caught exception is printed to #java.lang.System.err.

invokeCatching

public static java.lang.Object invokeCatching(java.lang.Object object,
                                              java.lang.reflect.Method method,
                                              java.io.PrintWriter out)
Invoke a method by calling Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions. Like . The method must have an empty parameter list.

invokeCatching

public static java.lang.Object invokeCatching(java.lang.Object object,
                                              java.lang.reflect.Method method)
Invoke a method by calling Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions. Like . The method must have an empty parameter list. The stack trace of a caught exception is printed to #java.lang.System.err.

invokeCatching

public static java.lang.Object invokeCatching(java.lang.Class cls,
                                              java.lang.Object object,
                                              java.lang.String methodName,
                                              java.lang.Class[] paramTypes,
                                              java.lang.Object[] args,
                                              java.io.PrintWriter out)
Get and invoke a method by calling Class.getMethod(java.lang.String, java.lang.Class[])/Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions. The stack trace of a caught exception is printed.
Parameters:
cls - containing class of the method to invoke.
object - object to invoke the method on. If the method is static, object is ignored and may be null.
methodName - method to invoke.
paramTypes - types of the method parameters.
args - actual parameters.
out - destination to print a caught exception to. No exceptions are printed if out is null.
See Also:
Method.invoke(java.lang.Object, java.lang.Object[]), Class.getMethod(java.lang.String, java.lang.Class[])

invokeCatching

public static java.lang.Object invokeCatching(java.lang.Class cls,
                                              java.lang.Object object,
                                              java.lang.String methodName,
                                              java.lang.Class[] paramTypes,
                                              java.lang.Object[] args)
Get and invoke a method by calling Class.getMethod(java.lang.String, java.lang.Class[])/Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions. Like invokeCatching(Class,Object,String,Class[],Object[],PrintWriter). The stack trace of a caught exception is printed to #java.lang.System.err.

invokeCatching

public static java.lang.Object invokeCatching(java.lang.Class cls,
                                              java.lang.Object object,
                                              java.lang.String methodName,
                                              java.io.PrintWriter out)
Get and invoke a method by calling Class.getMethod(java.lang.String, java.lang.Class[])/Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions. Like invokeCatching(Class,Object,String,Class[],Object[],PrintWriter). The method must have an empty parameter list.

invokeCatching

public static java.lang.Object invokeCatching(java.lang.Class cls,
                                              java.lang.Object object,
                                              java.lang.String methodName)
Get and invoke a method by calling Class.getMethod(java.lang.String, java.lang.Class[])/Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions. Like invokeCatching(Class,Object,String,Class[],Object[],PrintWriter). The method must have an empty parameter list. The stack trace of a caught exception is printed to #java.lang.System.err.

invokeCatching

public static java.lang.Object invokeCatching(java.lang.Object object,
                                              java.lang.String methodName,
                                              java.lang.Class[] paramTypes,
                                              java.lang.Object[] args,
                                              java.io.PrintWriter out)
Get and invoke a method by calling Class.getMethod(java.lang.String, java.lang.Class[])/Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions. The containing class of the method to invoke is extracted from object, that is, even for static methods an Object must be provided. The stack trace of a caught exception is printed.
Parameters:
object - object to invoke the method on.
methodName - method to invoke.
paramTypes - types of the method parameters.
args - actual parameters.
out - destination to print a caught exception to. No exceptions are printed if out is null.
See Also:
Method.invoke(java.lang.Object, java.lang.Object[]), Class.getMethod(java.lang.String, java.lang.Class[])

invokeCatching

public static java.lang.Object invokeCatching(java.lang.Object object,
                                              java.lang.String methodName,
                                              java.lang.Class[] paramTypes,
                                              java.lang.Object[] args)
Get and invoke a method by calling Class.getMethod(java.lang.String, java.lang.Class[])/Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions. Like invokeCatching(Object,String,Class[],Object[],PrintWriter). The stack trace of a caught exception is printed to #java.lang.System.err.

invokeCatching

public static java.lang.Object invokeCatching(java.lang.Object object,
                                              java.lang.String methodName,
                                              java.lang.Object[] args)
Get and invoke a method by calling Class.getMethod(java.lang.String, java.lang.Class[])/Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions. Like invokeCatching(Object,String,Class[],Object[],PrintWriter). The stack trace of a caught exception is printed to #java.lang.System.err. The parameter types are identified from the parameter objects, thus none of these must be null.

invokeCatching

public static java.lang.Object invokeCatching(java.lang.Object object,
                                              java.lang.String methodName,
                                              java.io.PrintWriter out)
Get and invoke a method by calling Class.getMethod(java.lang.String, java.lang.Class[])/Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions. Like invokeCatching(Object,String,Class[],Object[],PrintWriter). The method must have an empty parameter list.

invokeCatching

public static java.lang.Object invokeCatching(java.lang.Object object,
                                              java.lang.String methodName)
Get and invoke a method by calling Class.getMethod(java.lang.String, java.lang.Class[])/Method.invoke(java.lang.Object, java.lang.Object[]) and catch all exceptions. Like invokeCatching(Object,String,Class[],Object[],PrintWriter). The method must have an empty parameter list. The stack trace of a caught exception is printed to #java.lang.System.err.

write

public static void write(java.io.ObjectOutputStream out,
                         java.lang.reflect.Method method)
                  throws java.io.IOException
Serialize a Method object.

read

public static java.lang.reflect.Method read(java.io.ObjectInputStream in)
                                     throws java.lang.ClassNotFoundException,
                                            java.io.IOException
De-serialize a Method object.