From 29cd395888c767500b9d023db0f7e97b124bfad5 Mon Sep 17 00:00:00 2001 From: Redkale <22250530@qq.com> Date: Fri, 6 Jul 2018 18:53:39 +0800 Subject: [PATCH] =?UTF-8?q?RestConvert=E5=A2=9E=E5=8A=A0=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E8=BF=94=E5=9B=9EskipAllIgnore(true)=E7=9A=84Convert=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/org/redkale/net/http/Rest.java | 3 +++ src/org/redkale/net/http/RestConvert.java | 1 + 2 files changed, 4 insertions(+) diff --git a/src/org/redkale/net/http/Rest.java b/src/org/redkale/net/http/Rest.java index cdc8adee6..b2c459a40 100644 --- a/src/org/redkale/net/http/Rest.java +++ b/src/org/redkale/net/http/Rest.java @@ -133,6 +133,9 @@ public final class Rest { final JsonFactory childFactory = JsonFactory.create(); List types = new ArrayList<>(); for (RestConvert rc : converts) { + if (rc.type() == void.class || rc.type() == Void.class) { + return JsonFactory.create().skipAllIgnore(true).getConvert(); + } if (types.contains(rc.type())) throw new RuntimeException("@RestConvert type(" + rc.type() + ") repeat"); if (rc.skipIgnore()) { childFactory.registerSkipIgnore(rc.type()); diff --git a/src/org/redkale/net/http/RestConvert.java b/src/org/redkale/net/http/RestConvert.java index 4d12312cc..9ed108616 100644 --- a/src/org/redkale/net/http/RestConvert.java +++ b/src/org/redkale/net/http/RestConvert.java @@ -11,6 +11,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME; /** * 只能依附在Service实现类的public方法上, 当方法的返回值以JSON输出时对指定类型的转换设定。
+ * 注意: 如果 type() == void.class 则无视其他参数固定返回 JsonFactory.create().skipAllIgnore(true).getConvert(); * *

* 详情见: https://redkale.org