diff --git a/src/org/redkale/service/RetLabel.java b/src/org/redkale/service/RetLabel.java
index 094d6540e..0de46725f 100644
--- a/src/org/redkale/service/RetLabel.java
+++ b/src/org/redkale/service/RetLabel.java
@@ -10,6 +10,7 @@ import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.reflect.*;
import java.util.*;
+import java.util.function.BiFunction;
/**
* 用于定义错误码的注解
@@ -42,10 +43,16 @@ public @interface RetLabel {
RetLabel[] value();
}
+ public static interface RetInfoTransfer extends BiFunction {
+
+ }
+
public static abstract class RetLoader {
public static Map> loadMap(Class clazz) {
final Map> rets = new HashMap<>();
+ ServiceLoader loader = ServiceLoader.load(RetInfoTransfer.class);
+ RetInfoTransfer func = loader.findFirst().orElse(null);
for (Field field : clazz.getFields()) {
if (!Modifier.isStatic(field.getModifiers())) continue;
if (field.getType() != int.class) continue;
@@ -59,7 +66,7 @@ public @interface RetLabel {
continue;
}
for (RetLabel info : infos) {
- rets.computeIfAbsent(info.locale(), (k) -> new HashMap<>()).put(value, info.value());
+ rets.computeIfAbsent(info.locale(), (k) -> new HashMap<>()).put(value, func == null ? info.value() : func.apply(value, info.value()));
}
}
return rets;