{8.2.0-updated} @Query

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

- {@link oaj.http.annotation.Query}
  - {@link oaj.http.annotation.Query#_default() _default}, {@link oaj.http.annotation.Query#df() df} - Default value if not present.
  - {@link oaj.http.annotation.Query#_enum() _enum}, {@link oaj.http.annotation.Query#e() e} - Input validation. Must match one of the values.
  - {@link oaj.http.annotation.Query#allowEmptyValue() allowEmptyValue}, {@link oaj.http.annotation.Query#aev() aev} - Input validation. Allow empty value.
  - {@link oaj.http.annotation.Query#collectionFormat() collectionFormat}, {@link oaj.http.annotation.Query#cf() cf} - How collections of items are formatted.
  - {@link oaj.http.annotation.Query#exclusiveMaximum() exclusiveMaximum}, {@link oaj.http.annotation.Query#emax() emax} - Input validation. Whether maximum is exclusive.
  - {@link oaj.http.annotation.Query#exclusiveMinimum() exclusiveMinimum}, {@link oaj.http.annotation.Query#emin() emin} - Input validation. Whether minimum is exclusive.
  - {@link oaj.http.annotation.Query#format() format}, {@link oaj.http.annotation.Query#f() f} - The schema type format.
  - {@link oaj.http.annotation.Query#items() items} - The schema of items in a collection.
  - {@link oaj.http.annotation.Query#maximum() maximum}, {@link oaj.http.annotation.Query#max() max} - Input validation. Maximum numeric value.
  - {@link oaj.http.annotation.Query#maxItems() maxItems}, {@link oaj.http.annotation.Query#maxi() maxi} - Input validation. Maximum number of items in a collection.
  - {@link oaj.http.annotation.Query#maxLength() maxLength}, {@link oaj.http.annotation.Query#maxl() maxl} - Input validation. Maximum length of a string.
  - {@link oaj.http.annotation.Query#minimum() minimum}, {@link oaj.http.annotation.Query#min() min} - Input validation. Minimum numeric value.
  - {@link oaj.http.annotation.Query#minItems() minItems}, {@link oaj.http.annotation.Query#mini() mini} - Input validation. Minimum number of items in a collection.
  - {@link oaj.http.annotation.Query#minLength() minLength}, {@link oaj.http.annotation.Query#minl() minl} - Input validation. Minimum length of a string.
  - {@link oaj.http.annotation.Query#multipleOf() multipleOf}, {@link oaj.http.annotation.Query#mo() mo} - Input validation. Number must be a multiple of.
  - {@link oaj.http.annotation.Query#name() name}, {@link oaj.http.annotation.Query#n() n} - Query parameter name.
  - {@link oaj.http.annotation.Query#pattern() pattern}, {@link oaj.http.annotation.Query#p() p} - Input validation. Must match regular expression.
  - {@link oaj.http.annotation.Query#required() required}, {@link oaj.http.annotation.Query#r() r} - Input validation. Query parameter must be present.
  - {@link oaj.http.annotation.Query#serializer() serializer} - Override the part serializer.
  - {@link oaj.http.annotation.Query#skipIfEmpty() skipIfEmpty}, {@link oaj.http.annotation.Query#sie() sie} - Don't add if value is null or empty.
  - {@link oaj.http.annotation.Query#type() type}, {@link oaj.http.annotation.Query#t() t} - The schema type.
  - {@link oaj.http.annotation.Query#uniqueItems() uniqueItems}, {@link oaj.http.annotation.Query#ui() ui} - Input validation. Collections must contain unique items only.

##### Example:

@Remote(path="/myproxy") public interface MyProxy { // Explicit names specified for query parameters. @RemoteMethod String parameters( @Query("foo") String foo, @Query("bar") MyPojo pojo); // Multiple values pulled from a NameValuePairSupplier object. // Same as @Query("*"). @RemoteMethod String nameValuePairs(@Query NameValuePairSupplier nameValuePairSupplier); // Multiple values pulled from a Map. // Same as @Query("*"). @RemoteMethod String map(@Query Map<String,Object> map); // Multiple values pulled from a bean. // Same as @Query("*"). @RemoteMethod String bean(@Query MyBean myBean); // An entire query string as a String. // Same as @Query("*"). @RemoteMethod String string(@Query String string); // An entire query string as a Reader. // Same as @Query("*"). @RemoteMethod 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.NameValuePairSupplier} - 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 OpenApiSerializers}