RestConvert增加可以返回skipAllIgnore(true)的Convert功能

This commit is contained in:
Redkale
2018-07-06 18:53:39 +08:00
parent 9ca7855756
commit 29cd395888
2 changed files with 4 additions and 0 deletions

View File

@@ -133,6 +133,9 @@ public final class Rest {
final JsonFactory childFactory = JsonFactory.create();
List<Class> 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());

View File

@@ -11,6 +11,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* 只能依附在Service实现类的public方法上, 当方法的返回值以JSON输出时对指定类型的转换设定。 <br>
* 注意: 如果 type() == void.class 则无视其他参数固定返回 JsonFactory.create().skipAllIgnore(true).getConvert();
*
* <p>
* 详情见: https://redkale.org