Java Method Call invoke(Object object, Object[] args, String methodName)

Here you can find the source of invoke(Object object, Object[] args, String methodName)

Description

invoke

License

Open Source License

Declaration

public static Object invoke(Object object, Object[] args, String methodName) throws Exception 

Method Source Code


//package com.java2s;
/*/*from   w  ww.  ja  v  a 2  s . c  o m*/
 * ###license-information-start###
 * E-PIX - Enterprise Patient Identifier Cross-referencing
 * __
 * Copyright (C) 2009 - 2017 The MOSAIC Project - Institut fuer Community Medicine der
 *                      Universitaetsmedizin Greifswald - mosaic-projekt@uni-greifswald.de
 *                      concept and implementation
 *                      c. schack, d.langner, l. geidel
 *                      web client
 *                      a. blumentritt
 *                      g. weiher
 *                      please cite our publications
 *                      http://dx.doi.org/10.3414/ME14-01-0133
 *                      http://dx.doi.org/10.1186/s12967-015-0545-6
 * __
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * ###license-information-end###
 */

import java.lang.reflect.Method;

public class Main {
    public static Object invoke(Object object, Object[] args, String methodName) throws Exception {
        Method method = object.getClass().getMethod(methodName, new Class[] {});
        return method.invoke(object, args);
    }
}

Related

  1. invoke(Object obj, String methodName, Object... args)
  2. invoke(Object obj, String methodName, Object... params)
  3. invoke(Object obj, String methodName, Object[] params)
  4. invoke(Object obj, String name, Object... args)
  5. invoke(Object object, Method method)
  6. invoke(Object object, String function, Object... params)
  7. invoke(Object object, String function, String parameter)
  8. invoke(Object object, String method, Object... args)
  9. invoke(Object object, String methodName)