Skip to main content

@Query

The @Query annotation can be applied to arguments of @RemoteOp-annotated methods to denote that they are query parameters on the request.

@Queryname - Query parameter name.serializer - Override the part serializer.
Example
@Remote(path="/myproxy")
public interface MyProxy {

// Explicit names specified for query parameters.
@RemoteGet
String parameters(
@Query("foo") String foo,
@Query("bar") MyPojo pojo);

// Multiple values pulled from a PartList object.
// Same as @Query("*").
@RemoteGet
String partList(@Query PartList partList);

// Multiple values pulled from a Map.
// Same as @Query("*").
@RemoteGet
String map(@Query Map map);

// Multiple values pulled from a bean.
// Same as @Query("*").
@RemoteGet
String bean(@Query MyBean myBean);

// An entire query string as a String.
// Same as @Query("*").
@RemoteGet
String string(@Query String string);

// An entire query string as a Reader.
// Same as @Query("*").
@RemoteGet
String reader(@Query Reader reader);
}

Query arguments can be any of the following types:

  • Single-part arguments (i.e. those with name != "*"):

  • Multi-part arguments (i.e. those with name == "*" or empty):

    • Reader - Raw contents of Reader will be serialized directly as query string.
    • PartList - Serialized as individual query parameters.
    • Map<String,Object> - Converted to key-value pairs. Values serialized using the registered HttpPartSerializer (OpenApiSerializer by default).
    • Bean - Converted to key-value pairs. Values serialized using the registered HttpPartSerializer (OpenApiSerializer by default).
    • CharSequence - Serialized directly as query string.

See the link below for information about supported data types in OpenAPI serialization.