This commit is contained in:
@@ -7,6 +7,7 @@ package org.redkale.service;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.function.Function;
|
||||||
import org.redkale.convert.*;
|
import org.redkale.convert.*;
|
||||||
import org.redkale.convert.json.*;
|
import org.redkale.convert.json.*;
|
||||||
import org.redkale.util.Utility;
|
import org.redkale.util.Utility;
|
||||||
@@ -101,6 +102,20 @@ public class RetResult<T> {
|
|||||||
return new RetResult(Utility.ofMap(items));
|
return new RetResult(Utility.ofMap(items));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将RetResult<X> 转换成 RetResult<Y>
|
||||||
|
*
|
||||||
|
* @param <R> 目标数据类型
|
||||||
|
* @param mapper 转换函数
|
||||||
|
*
|
||||||
|
* @return RetResult
|
||||||
|
*
|
||||||
|
* @since 2.1.0
|
||||||
|
*/
|
||||||
|
public <R> RetResult<R> mapTo(Function<T, R> mapper) {
|
||||||
|
return new RetResult<>(mapper.apply(this.result));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同 setRetcode
|
* 同 setRetcode
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user