mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-13 02:14:52 +00:00
ref[storage]: refactor lambda of storage
This commit is contained in:
1 parent
a6fe28d518
commit
a6f06579b1
4 files changed
+4
-6
No files matched your search
@@ -24,9 +24,7 @@ import org.springframework.lang.Nullable;
|
||||
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.*;
|
||||
|
||||
@@ -258,7 +256,7 @@ public class StorageObject<K, V> implements IStorage<K, V> {
|
||||
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())
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -21,6 +21,6 @@ public interface Func0<R> extends Serializable {
|
||||
* @return 函数执行结果
|
||||
* @throws Exception 自定义异常
|
||||
*/
|
||||
R call() throws Exception;
|
||||
R apply() throws Exception;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user