Java Reflection Method Invoke invokeMethod(Method method, Object object, Object... arguments)

Here you can find the source of invokeMethod(Method method, Object object, Object... arguments)

Description

Fail-safe call.

License

Open Source License

Parameter

Parameter Description
method a parameter
object a parameter
arguments a parameter

Return

null in case of errors.

Declaration

public static Object invokeMethod(Method method, Object object, Object... arguments) 

Method Source Code

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

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Main {
    /**/*www . j  a  v a  2s .  c om*/
     * Fail-safe call.
     * @param method
     * @param object
     * @param arguments
     * @return null in case of errors.
     */
    public static Object invokeMethod(Method method, Object object, Object... arguments) {
        try {
            return method.invoke(object, arguments);
        } catch (IllegalAccessException e) {
        } catch (IllegalArgumentException e) {
        } catch (InvocationTargetException e) {
        }
        return null;
    }
}

Related

  1. invokeMethod(Method method, Class beanClass, Object element)
  2. invokeMethod(Method method, Object bean, Object[] values)
  3. invokeMethod(Method method, Object instance, Object... parameters)
  4. invokeMethod(Method method, Object object)
  5. invokeMethod(Method method, Object object, Object... args)
  6. invokeMethod(Method method, Object target)
  7. invokeMethod(Method method, Object target)
  8. invokeMethod(Method method, Object target)
  9. invokeMethod(Method method, Object target, Class expectedType)