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

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

Description

invoke Method

License

Apache License

Declaration

public static Object invokeMethod(Method method, Object object) throws Exception 

Method Source Code

//package com.java2s;
/*/*w ww .ja va  2s. c  om*/
 * Copyright (C) 2013 Peng fei Pan <sky@xiaopan.me>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.lang.reflect.Method;

public class Main {
    public static final Object[] EMPTY_PARAMS = new Object[0];

    public static Object invokeMethod(Method method, Object object) throws Exception {
        return method.invoke(object, EMPTY_PARAMS);
    }
}

Related

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