001package io.avaje.http.api;
002
003import java.lang.annotation.Retention;
004import java.lang.annotation.Target;
005
006import static java.lang.annotation.ElementType.METHOD;
007import static java.lang.annotation.ElementType.PARAMETER;
008import static java.lang.annotation.RetentionPolicy.RUNTIME;
009
010/**
011 * A parameter that is a bean containing query parameters, headers and cookies.
012 * <p>
013 * The properties on the bean are by default treated as query parameters.
014 * </p>
015 * <p>
016 * This is functionally very similar to <code>@Form</code> but intended for
017 * use with all other cases than FORM POST.
018 * </p>
019 *
020 * <h4>Example</h4>
021 * <p>
022 * Simple bean parameter, properties default to query parameters matching the property name.
023 * </p>
024 *
025 * <pre>{@code
026 *
027 *   public class MyParams {
028 *
029 *     public String filter;
030 *
031 *     @Default("name")
032 *     public String orderBy;
033 *
034 *     public int firstRow;
035 *     public int maxRows
036 *
037 *     @Header
038 *     public String lastModified;
039 *   }
040 *
041 *   ...
042 *
043 *   @Get("/search")
044 *   List<Customer> findCustomers(@BeanParam MyParams params) {
045 *     ...
046 *   }
047 *
048 * }</pre>
049 */
050@Target(value={PARAMETER,METHOD})
051@Retention(value=RUNTIME)
052public @interface BeanParam {
053
054}