Code example for Method

Methods: getDeclaringClass, getName, getParameterTypes, invoke

0
//          } else if (method.getDeclaringClass() == CoreSession.class) { 
//          return method.invoke(getSession(), args); 
//          } else { 
//          return method.invoke(this, args); 
//          } 
            if (method.getDeclaringClass() == CoreSession.class) {
                Method m = methods.get(method); // check if method was overwritten
                if (m == null) {
                    try { 
                        m = getClass().getMethod(method.getName(), method.getParameterTypes());
                    } catch (NoSuchMethodException e) {
                        m = method;
                    } 
                    methods.put(method, m);
                } 
                return m.invoke(m == method ? getSession() : this, args);
            } 
            return method.invoke(this, args);
        } catch (InvocationTargetException e) {
            // throw a ClientException 
            Throwable cause = e.getCause();
            if (exceptionHandler != null) {
                exceptionHandler.handleException(cause);