{title:'@Query', updated:'8.2.0', updated:'9.0.0'}

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

- {@link oaj.http.annotation.Query}
  - {@link oaj.http.annotation.Query#name() name} - Query parameter name.
  - {@link oaj.http.annotation.Query#serializer() 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<String,Object> 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); | }

Single-part arguments (i.e. those with name != "*") can be any of the following types:

- Any serializable POJO - Converted to a string using the {@link oaj.httppart.HttpPartSerializer} registered with the RestClient ({@link oaj.oapi.OpenApiSerializer} by default) or associated via the {@link oaj.http.annotation.Query#serializer() @Query(serializer)} annotation.

Multi-part arguments (i.e. those with name == "*" or empty) can be any of the following types:

- {@link java.io.Reader} - Raw contents of {@code Reader} will be serialized directly a query string.
- {@link oaj.http.part.PartList} - Serialized as individual query parameters.
- Map - Converted to key-value pairs.
  Values serialized using the registered {@link oaj.httppart.HttpPartSerializer} ({@link oaj.oapi.OpenApiSerializer} by default).
- Bean - Converted to key-value pairs.
  Values serialized using the registered {@link oaj.httppart.HttpPartSerializer} ({@link oaj.oapi.OpenApiSerializer} by default).
- CharSequence - Serialized directly a query string.

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

- {@doc jm.OpenApiSerializers}