Here you can find the source of invokeSilent(Object obj, String methodName, Class[] parameterTypes, Object[] args)
public static Object invokeSilent(Object obj, String methodName, Class[] parameterTypes, Object[] args)
//package com.java2s; //License from project: Apache License import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class Main { public static final Class[] EMPTY_CLASSES = new Class[0]; public static final Object[] EMPTY_PARAMS = EMPTY_CLASSES; public static Object invokeSilent(Object obj, String methodName, Class[] parameterTypes, Object[] args) { try {/*from ww w . ja v a2 s .co m*/ return invoke(obj, methodName, parameterTypes, args); } catch (Exception e) { // ignore return null; } } public static Object invoke(Object obj, String methodName, Class[] parameterTypes, Object[] args) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { if (parameterTypes == null) parameterTypes = EMPTY_CLASSES; Method method = obj.getClass().getMethod(methodName, parameterTypes); if (args == null) args = EMPTY_PARAMS; return method.invoke(obj, args); } }