Java Method Call invokeVoidSafe(Object obj, String methodName, Class paramClass, Object param)

Here you can find the source of invokeVoidSafe(Object obj, String methodName, Class paramClass, Object param)

Description

invoke Void Safe

License

Open Source License

Declaration

public static void invokeVoidSafe(Object obj, String methodName, Class paramClass, Object param) 

Method Source Code


//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
        }

    }
}

Related

  1. invokeValue(AnnotatedElement element, Class annotationClass)
  2. invokeVirtual(String methodName, Object onObj, Class[] declaredArgTypes, Object... withArgs)
  3. invokeVirtual(T o, Method method, Object... pa)
  4. invokeVoid(MethodHandle mh)
  5. invokeVoidNoArgMethod(Class declaringClass, String methodName, Object instance)
  6. invokeWithoutDeclaredExceptions(Method method, Object target, Object... args)
  7. invokeWithoutInvocationException(Method m, Object obj, Object... args)