![JAR search and dependency download from the Maven repository](/logo.png)
com.gitee.sergius.apitool.annotation.ApiResponse Maven / Gradle / Ivy
package com.gitee.sergius.apitool.annotation;
import com.gitee.sergius.apitool.constant.DataType;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* @author shawn yang
* @version 1.0.0
* 该注解可以用在方法上面,当响应参数不能通过方法返回类型直接判断出来时使用,
* 可以单独使用,也可以结合{@link ApiResponses}一起使用
*
*/
@Target(METHOD)
@Retention(RUNTIME)
@Documented
public @interface ApiResponse {
/**
* 参数名
*/
String name() ;
/**
* 参数说明,描述参数具体含义
*/
String desc() default "";
/**
* 参数类型.
* 如果是CLASS , clazz必填.
* @see DataType
*/
DataType dataType() ;
/**
* 当{@link #dataType()}为DataType#CLASS时,该字段必填,表示要解析参数的类
*/
Class clazz() default Object.class;
/**
* 如果数据类型是{@link java.util.Set}(包含子类)、{@link java.util.List}(包含子类)、数组,此项需设置为{@code true}
*/
boolean isArray() default false;
/**
* 是否为必填字段
*/
boolean required() default true;
/**
* 参数示例,如果不设置,将采用{@link DataType} 中配置的默认值
*/
String example() default "";
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy