< R extends Request < T > > R setRequestQueue ( RequestQueue requestQueue ) { checkIfActive ( ) ; java . lang . reflect . Method m = null ; if ( ! ( this . getClass ( ) . equals ( Request . class ) ) ) { try { m = this . getClass ( ) . getDeclaredMethod ( "parseNetworkResponse" , NetworkResponse . class ) ; } catch ( NoSuchMethodException e ) { //e.printStackTrace(); } } if ( converterFromResponse == null ) { Type t ; if ( responseType != null ) { t = responseType ; } else { t = tryIdentifyResultType ( this ) ; } if ( t == null ) { throw new IllegalArgumentException ( "Cannot resolve Response type in order to " + "identify Response Converter for Request : " + this ) ; } try { this . converterFromResponse = ( Converter < NetworkResponse , T > ) requestQueue . getResponseConverter ( t , new Annotation [ 0 ] ) ; } catch ( IllegalArgumentException ex ) { //check if parseNetworkResponse is overridden if ( m == null ) { //it is not so it is for sure that we cannot parse response thus throw throw ex ; } //else keep quiet as conversion can probably be handled by the overridden method. // if it fails parse exception will be thrown. } } if ( retryPolicy == null ) { setRetryPolicy ( new DefaultRetryPolicy ( this ) ) ; } this . requestQueue = requestQueue ; return ( R ) this ; }
Associates this request with the given queue . The request queue will be notified when this request has finished .