@SuppressWarnings("unchecked") protected static <T>T invoke(Method method,Object object,Object... parameters) throws IOException, RuntimeException {
  try {
    return (T)method.invoke(object,parameters);
  }
 catch (  IllegalArgumentException e) {
    throw new RuntimeException(e);
  }
catch (  IllegalAccessException e) {
    throw new RuntimeException(e);
  }
catch (  InvocationTargetException e) {
    if (e.getTargetException() instanceof IOException) {
      throw (IOException)e.getTargetException();
    }
 else {
      throw new RuntimeException(e);
    }
  }
}

@ SuppressWarnings ( "unchecked" ) protected static < T > T invoke ( Method method , Object object , Object ... parameters ) throws IOException , RuntimeException { try { return ( T ) method . invoke ( object , parameters ) ; } catch ( IllegalArgumentException e ) { throw new RuntimeException ( e ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( e ) ; } catch ( InvocationTargetException e ) { if ( e . getTargetException ( ) instanceof IOException ) { throw ( IOException ) e . getTargetException ( ) ; } else { throw new RuntimeException ( e ) ; } } }
invoke a method on an object and return whatever it returns .
