Java Method Call invokePrivate(Class clazz, Object instance, String methodName, Class[] argTypes, Object[] args)

Here you can find the source of invokePrivate(Class clazz, Object instance, String methodName, Class[] argTypes, Object[] args)

Description

invoke Private

License

Open Source License

Declaration

public static Object invokePrivate(Class<?> clazz, Object instance, String methodName, Class<?>[] argTypes,
            Object[] args) 

Method Source Code

//package com.java2s;

import java.lang.reflect.Method;

public class Main {
    public static Object invokePrivate(Class<?> clazz, Object instance, String methodName, Class<?>[] argTypes,
            Object[] args) {// www.jav  a2  s . c  om

        try {
            Method method = clazz.getDeclaredMethod(methodName, argTypes);
            method.setAccessible(true);
            return method.invoke(instance, args);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. invokeObjectMethod(Object object, String name, Class paramTypes[], Object args[])
  2. invokeOrBailOut(Object invokee, Method method, Object[] params)
  3. invokeParameterlessMethod(T theObject, String methodName)
  4. invokePrepare(Object instance)
  5. invokePrimivite(Object entity, Method writeMethod, Class propertyType, String propertyValue)
  6. invokePrivate(String name, final Object obj, Object[] objects)
  7. invokePrivateMethod(Method method, Object object, Object... args)
  8. invokePrivateMethod(Object instance, String name, Object... args)
  9. invokePrivateMethod(Object obj, String methodName, Class[] parameterTypes, Object[] args)