Code example for InvocationHandler

Methods: invoke

0
     */ 
    public static Object invoke(final Object instance, final Method m, final InvocationHandler handler, final Object[] args)
            throws Throwable { 
        m.setAccessible(true);
        try { 
            return handler.invoke(instance, m, args);
        } catch (Throwable e) {
            if (e instanceof InvocationTargetException) {
                throw e.getCause();
            } 
            throw e;
        } finally { 
            m.setAccessible(false);
        } 
 
    } 
}