public RequestParameterBuilder paramJson ( String name , Object value , String type ) throws UnsupportedEncodingException { String encodedJsonValue = encodeJson ( value , type ) ; if ( added || originalUrl . contains ( "?" ) ) { buffer . append ( "&" ) ; } else { buffer . append ( "?" ) ; } buffer . append ( name ) ; buffer . append ( "=" ) ; buffer . append ( encodedJsonValue ) ; // set a flag that at least one request parameter was added added = true ; return this ; }
Adds a request parameter to the URL with specifying a data type of the given parameter value . Data type is sometimes required especially for Java generic types because type information is erased at runtime and the conversion to JSON will not work properly . Parameter s value is converted to JSON notation when adding . Furthermore it will be encoded according to the acquired encoding .