forked from plusone/plusone-commons
构造 PageResult 时,如果 list 是 null,则自动转为空列表,不抛异常。
parent
8a60f4db66
commit
8f588c25b5
|
@ -20,7 +20,7 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
|
||||
import xyz.zhouxy.plusone.commons.annotation.StaticFactoryMethod;
|
||||
import xyz.zhouxy.plusone.commons.util.AssertTools;
|
||||
import xyz.zhouxy.plusone.commons.collection.CollectionTools;
|
||||
|
||||
/**
|
||||
* 返回分页查询的结果
|
||||
|
@ -37,8 +37,7 @@ public class PageResult<T> {
|
|||
private final List<T> content;
|
||||
|
||||
private PageResult(List<T> content, long total) {
|
||||
AssertTools.checkNotNull(content, "Content must not be null.");
|
||||
this.content = content;
|
||||
this.content = CollectionTools.nullToEmptyList(content);
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue