Java Reflection Method Invoke invoke(Method method, T instance, Object... params)

Here you can find the source of invoke(Method method, T instance, Object... params)

Description

invoke

License

Open Source License

Declaration

static public <T> Object invoke(Method method, T instance, Object... params) 

Method Source Code

//package com.java2s;

import java.lang.reflect.Method;

public class Main {
    static public <T> Object invoke(Method method, T instance, Object... params) {
        try {/*from   w w  w . j a v a  2 s.c  o  m*/
            if (params == null) {
                return method.invoke(instance);
            } else {
                return method.invoke(instance, params);
            }
        } catch (Exception e) {
            return null;
            //throw new ClassUtilsException(e);
        }
    }
}

Related

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