Skip to content

Commit

Permalink
ref[storage]: refactor lambda of storage
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysunxiao committed Oct 21, 2023
1 parent a6fe28d commit a6f0657
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
import org.springframework.util.ConcurrentReferenceHashMap;

import java.io.InputStream;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.*;

Expand Down Expand Up @@ -258,7 +256,7 @@ private <INDEX> String getMethodToField(Func1<V, INDEX> func) {
var fields = clazz.getDeclaredFields();
Arrays.stream(fields).forEach(ReflectionUtils::makeAccessible);
for (var value : dataMap.values()) {
var r = func.call(value);
var r = func.apply(value);
var valueFields = Arrays.stream(fields)
.map(it -> ReflectionUtils.getField(it, value))
.filter(it -> it.equals(r) && it.getClass() == r.getClass())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public interface Func<P, R> extends Serializable {
* @throws Exception 自定义异常
*/
@SuppressWarnings("unchecked")
R call(P... parameters) throws Exception;
R apply(P... parameters) throws Exception;

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public interface Func0<R> extends Serializable {
* @return 函数执行结果
* @throws Exception 自定义异常
*/
R call() throws Exception;
R apply() throws Exception;

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public interface Func1<P, R> extends Serializable {
* @return 函数执行结果
* @throws Exception 自定义异常
*/
R call(P parameter) throws Exception;
R apply(P parameter) throws Exception;

}

0 comments on commit a6f0657

Please sign in to comment.