public RpcRequest getRequest ( final Invocation invocation ) { if ( invocation == null ) throw new NullPointerException ( "invocation" ) ; MethodDescriptor < ? , ? > method = invocation . getMethod ( ) ; if ( ! method . isTerminal ( ) ) { throw new IllegalArgumentException ( "Last invocation method must be terminal" ) ; } RpcRequest request = new RpcRequest ( method . isPost ( ) ? RpcRequest . POST : RpcRequest . GET ) ; for ( Invocation invocation1 : invocation . toChain ( ) ) { writeInvocation ( request , invocation1 ) ; } return request ; }
Converts an invocation into an rpc request .