Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.gemini.blueprint.util.internal
Class ReflectionUtils

    java.lang.Object
      org.eclipse.gemini.blueprint.util.internal.ReflectionUtils

    public abstract class ReflectionUtils

extends Object

Reflection related utility class. Similar to that found inside main Spring distribution but with customizations particular to this framework.

Author:
  Costin Leau
See Also:
  `ReflectionUtils`

Nested Class Summary
`static class` | `ReflectionUtils.InvocationCheckedExceptionWrapper` Runtime exception wrapper for checked exceptions thrown by invoked methods.

Constructor Summary
`ReflectionUtils()`

Method Summary
`static Exception` | `getInvocationException(Exception exception)` Analyze the given exception and, if it's of type `ReflectionUtils.InvocationCheckedExceptionWrapper` then will return the actual cause, otherwise return the original exception given.
`static void` | `handleInvocationTargetException(InvocationTargetException ex)` Handle the given invocation target exception.
`static Object` | `invokeMethod(Method method, Object target)` Invoke the specified `Method` against the supplied target object with no arguments.
`static Object` | `invokeMethod(Method method, Object target, Object[] args)` Invoke the specified `Method` against the supplied target object with the supplied arguments.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ReflectionUtils

    public ReflectionUtils()

Method Detail

### invokeMethod

    public static Object invokeMethod(Method method,
                                      Object target)

  Invoke the specified `Method` against the supplied target object with no arguments. The target object can be `null` when invoking a static `Method`.

  This method is identical to `ReflectionUtils.invokeMethod(Method, Object)` except that if the target method throws a checked exception, the method will throw a InvocationCheckedException.

  Thrown exceptions are handled via a call to `#handleReflectionException`.

  Parameters:
    `method` - the method to invoke
    `target` - the target object to invoke the method on
  Returns:
    the invocation result, if any
  See Also:
    `invokeMethod(java.lang.reflect.Method, Object, Object[])`

### invokeMethod

    public static Object invokeMethod(Method method,
                                      Object target,
                                      Object[] args)

  Invoke the specified `Method` against the supplied target object with the supplied arguments. The target object can be `null` when invoking a static `Method`.

  This method is identical to `ReflectionUtils.invokeMethod(Method, Object)` except that if the target method throws a checked exception, the method will throw a InvocationCheckedException.

  Thrown exceptions are handled via a call to `#handleReflectionException`.

  Parameters:
    `method` - the method to invoke
    `target` - the target object to invoke the method on
    `args` - the invocation arguments (may be `null`)
  Returns:
    the invocation result, if any
  See Also:
    `invokeMethod(java.lang.reflect.Method, Object, Object[])`

### handleInvocationTargetException

    public static void handleInvocationTargetException(InvocationTargetException ex)

  Handle the given invocation target exception. Should only be called if no checked exception is expected to be thrown by the target method.

  Throws the underlying RuntimeException or Error in case of such a root cause. Throws an InvocationCheckedException else (the main difference from `ReflectionUtils.handleInvocationTargetException(InvocationTargetException)`.

  Parameters:
    `ex` - the invocation target exception to handle

### getInvocationException

    public static Exception getInvocationException(Exception exception)

  Analyze the given exception and, if it's of type `ReflectionUtils.InvocationCheckedExceptionWrapper` then will return the actual cause, otherwise return the original exception given.

  Parameters:
    `exception` - invocation exception
  Returns:
    actual target exception, in case any wrapping took place

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2012. All Rights Reserved.