Code example for InvocationTargetException

Methods: getCausegetTargetException

0
    protected final CachedMethod method;
 
    public ReflectionMetaMethod(CachedMethod method) {
        this.method = method;
        setParametersTypes(method.getParameterTypes());
    } 
 
    public int getModifiers() { 
        return method.getModifiers();
    } 
 
    public String getName() {
        return method.getName();
    } 
 
    public Class getReturnType() {
        return method.getReturnType();
    } 
 
    public CachedClass getDeclaringClass() { 
        return method.cachedClass;
    } 
 
    public Object invoke(Object object, Object[] arguments) { 
        try { 
            return method.setAccessible().invoke(object, arguments);
        } catch (IllegalArgumentException e) {
            throw new InvokerInvocationException(e);
        } catch (IllegalAccessException e) {
            throw new InvokerInvocationException(e);
        } catch (InvocationTargetException e) {
            throw e.getCause() instanceof RuntimeException ? (RuntimeException)e.getCause() : new InvokerInvocationException(e);
        } 
    } 
 
    public String toString () {
        return method.toString();