Java Reflection Method Invoke invoke(MethodHandle methodHandle, Object... params)

Here you can find the source of invoke(MethodHandle methodHandle, Object... params)

Description

Wraps any non-runtime exceptions with a runtime exception

License

Open Source License

Declaration

public static <T> T invoke(MethodHandle methodHandle, Object... params) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.lang.invoke.MethodHandle;

public class Main {
    /** Wraps any non-runtime exceptions with a runtime exception */
    public static <T> T invoke(MethodHandle methodHandle, Object... params) {
        try {/*from   ww  w.j a v  a2 s  .  c  om*/
            return (T) methodHandle.invokeWithArguments(params);
        } catch (RuntimeException e) {
            throw e;
        } catch (Throwable throwable) {
            throw new RuntimeException(throwable);
        }
    }
}

Related

  1. invoke(Method method, Object object, Object... parameters)
  2. invoke(Method method, Object object, Object[] args, Class exceptionToThrow)
  3. invoke(Method method, Object target, Object... args)
  4. invoke(Method method, Object target, Object... arguments)
  5. invoke(Method method, T instance, Object... params)
  6. invokeJdbcMethod(Method method, Object target)
  7. invokeJdbcMethod(Method method, Object target)
  8. invokeMethod(Class clazz, Object classObject, String methodName, Class[] paramTypes, Object... args)
  9. invokeMethod(Class clazz, Object obj, String methodName, Class[] parametersTypes, Object[] parameters)