Here you can find the source of invokeVoidSafe(Object obj, String methodName, Class paramClass, Object param)
public static void invokeVoidSafe(Object obj, String methodName, Class paramClass, Object param)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class Main { public static void invokeVoidSafe(Object obj, String methodName, Class paramClass, Object param) { try {//from w w w .j a v a 2s. co m Method method = obj.getClass().getMethod(methodName, paramClass); method.invoke(obj, param); } catch (SecurityException e) { // ignored } catch (NoSuchMethodException e) { // ignored } catch (IllegalArgumentException e) { // ignored } catch (IllegalAccessException e) { // ignored } catch (InvocationTargetException e) { // ignored } } }