RestConvert增加可以返回skipAllIgnore(true)的Convert功能
This commit is contained in:
@@ -133,6 +133,9 @@ public final class Rest {
|
|||||||
final JsonFactory childFactory = JsonFactory.create();
|
final JsonFactory childFactory = JsonFactory.create();
|
||||||
List<Class> types = new ArrayList<>();
|
List<Class> types = new ArrayList<>();
|
||||||
for (RestConvert rc : converts) {
|
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 (types.contains(rc.type())) throw new RuntimeException("@RestConvert type(" + rc.type() + ") repeat");
|
||||||
if (rc.skipIgnore()) {
|
if (rc.skipIgnore()) {
|
||||||
childFactory.registerSkipIgnore(rc.type());
|
childFactory.registerSkipIgnore(rc.type());
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 只能依附在Service实现类的public方法上, 当方法的返回值以JSON输出时对指定类型的转换设定。 <br>
|
* 只能依附在Service实现类的public方法上, 当方法的返回值以JSON输出时对指定类型的转换设定。 <br>
|
||||||
|
* 注意: 如果 type() == void.class 则无视其他参数固定返回 JsonFactory.create().skipAllIgnore(true).getConvert();
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
* 详情见: https://redkale.org
|
* 详情见: https://redkale.org
|
||||||
|
|||||||
Reference in New Issue
Block a user