jodd.util
Class ReflectUtil

java.lang.Object
  extended byjodd.util.ReflectUtil

public final class ReflectUtil
extends java.lang.Object

Misc java.lang.reflect utils.


Constructor Summary
ReflectUtil()
           
 
Method Summary
static java.lang.reflect.Method getMethod(java.lang.Object o, java.lang.String methodName)
          Returns method from an object, matched by name.
static java.lang.Object invoke(java.lang.Object obj, java.lang.String method, java.lang.Object[] params)
          Invokes method of an object without specifying parameter types.
static java.lang.Object invoke(java.lang.Object obj, java.lang.String method, java.lang.Object[] params, java.lang.Class[] param_types)
          Invokes a method in object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectUtil

public ReflectUtil()
Method Detail

getMethod

public static java.lang.reflect.Method getMethod(java.lang.Object o,
                                                 java.lang.String methodName)
Returns method from an object, matched by name.

Parameters:
o - Object that is examined.
methodName - Full name of the method.
Returns:
null if method not found

invoke

public static java.lang.Object invoke(java.lang.Object obj,
                                      java.lang.String method,
                                      java.lang.Object[] params,
                                      java.lang.Class[] param_types)
                               throws java.lang.IllegalAccessException,
                                      java.lang.NoSuchMethodException,
                                      java.lang.reflect.InvocationTargetException
Invokes a method in object.

Parameters:
obj - object
method - name of the objects method
params - method parameters
param_types - method parameter types
Returns:
invoked method results
Throws:
java.lang.IllegalAccessException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException

invoke

public static java.lang.Object invoke(java.lang.Object obj,
                                      java.lang.String method,
                                      java.lang.Object[] params)
                               throws java.lang.IllegalAccessException,
                                      java.lang.NoSuchMethodException,
                                      java.lang.reflect.InvocationTargetException
Invokes method of an object without specifying parameter types. It examines all methods of object and finds those that has the same name. Mathced methods are further examined for types: if given parameters are instances of matched method types then method is matched and will be executed.

Parameters:
obj - object
method - method of an object
params - method parameters
Returns:
whatever invoked method returns
Throws:
java.lang.IllegalAccessException
java.lang.NoSuchMethodException
java.lang.reflect.InvocationTargetException


Jodd v0.24.5 Javadoc