Here you can find the source of invokeAccessableMethodWithArguments(Object instance, String method, Object... arguments)
public static void invokeAccessableMethodWithArguments(Object instance, String method, Object... arguments)
//package com.java2s; //License from project: Apache License import java.lang.reflect.InvocationTargetException; public class Main { public static void invokeAccessableMethodWithArguments(Object instance, String method, Object... arguments) { Class<?>[] classes = new Class[arguments.length]; for (int x = 0; x < arguments.length; x++) { classes[x] = arguments[x].getClass(); }/*w ww . j a va2 s . c om*/ try { instance.getClass().getMethod(method, classes).invoke(instance, arguments); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ignored) { } } }