io.github.danielliu1123.httpexchange.BeanParam Maven / Gradle / Ivy
package io.github.danielliu1123.httpexchange;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Map;
import org.springframework.web.bind.annotation.RequestParam;
/**
* Convert a Java bean to query parameters.
*
* Correct usage:
*
{@code
* @GetExchange
* User get(@BeanParam User user);
*
* @GetExchange
* User get(@RequestParam Map user);
* }
*
* NOTE: if you consider using {@link Map} as a parameter type, you should use {@link RequestParam} instead.
*
Incorrect usage:
*
{@code
* @GetExchange
* User get(@BeanParam Map user); // use @RequestParam instead
* }
*
* @author Freeman
* @since 3.1.2
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER})
public @interface BeanParam {}