feature: tag功能.

This commit is contained in:
lijiahang
2023-09-07 09:47:53 +08:00
parent abfe879961
commit 2e121a8e90
19 changed files with 622 additions and 108 deletions

View File

@@ -7,6 +7,8 @@ import java.lang.annotation.*;
*
* @author Jiahang Li
* @version 1.0.0
* @see Void#TYPE
* @see IgnoreWrapper
* @since 2021/4/2 12:34
*/
@Target({ElementType.TYPE})

View File

@@ -29,11 +29,13 @@ public class WrapperResultHandler implements ResponseBodyAdvice<Object> {
@Override
public boolean supports(MethodParameter methodParameter, @NotNull Class converterType) {
// 统一返回值
// 检查是否包含统一返回值注解
if (!methodParameter.getContainingClass().isAnnotationPresent(RestWrapper.class)) {
return false;
}
return !methodParameter.hasMethodAnnotation(IgnoreWrapper.class);
// 检查是否包含忽略返回值注解 && 方法返回值不为 void
return !methodParameter.hasMethodAnnotation(IgnoreWrapper.class) &&
methodParameter.getExecutable().getAnnotatedReturnType().getType() != Void.TYPE;
}
@Override