@Documented
@Target(value=PARAMETER)
@Retention(value=RUNTIME)
public @interface Query
Values are converted to strings using String.valueOf(Object)
and then URL encoded.
null
values are ignored. Passing a List
or array will result in a
query parameter for each non-null
item.
Simple Example:
@GET("/list") void list(@Query("page") int page);Calling with
foo.list(1)
yields /list?page=1
.
Example with null
:
@GET("/list") void list(@Query("category") String category);Calling with
foo.list(null)
yields /list
.
Array Example:
@GET("/list") void list(@Query("category") String... categories);Calling with
foo.list("bar", "baz")
yields
/list?category=foo&category=bar
.EncodedQuery
,
QueryMap
,
EncodedQueryMap
Modifier and Type | Required Element and Description |
---|---|
java.lang.String |
value |
Copyright © 2014 Square, Inc.. All Rights Reserved.