@ Override public Object invoke ( Object [ ] vals ) throws InvocationTargetException { Object [ ] tmp ; int i ; try { if ( isStatic ( ) ) { return meth . invoke ( null , vals ) ; } else { if ( vals . length == 0 ) { throw new IllegalArgumentException ( "invalid arguments" ) ; } tmp = new Object [ vals . length - 1 ] ; for ( i = 1 ; i < vals . length ; i ++ ) { tmp [ i - 1 ] = vals [ i ] ; } return meth . invoke ( vals [ 0 ] , tmp ) ; } } catch ( InvocationTargetException | IllegalArgumentException e ) { throw e ; } catch ( IllegalAccessException e ) { // isValid should prevent this throw new RuntimeException ( "can't access method" ) ; } }
Invokes the wrapped Java Method . Throws Exceptions raised in the Java Method .