mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
fix: EnumValue枚举方法级别逻辑判断优化
This commit is contained in:
parent
64a625d098
commit
646caa4c8f
@ -74,6 +74,10 @@ public class EnumWrapper<E extends Enum<E>> {
|
||||
if (!hasEnumValueAnnotation) {
|
||||
Method enumValueMethod = ClassUtil.getFirstMethod(enumClass, method -> method.getAnnotation(EnumValue.class) != null);
|
||||
if (enumValueMethod != null) {
|
||||
String methodName = enumValueMethod.getName();
|
||||
if (!(methodName.startsWith("get") && methodName.length() > 3)) {
|
||||
throw new IllegalStateException("Can not find get method \"" + methodName + "()\" in enum: " + enumClass.getName());
|
||||
}
|
||||
this.getterMethod = enumValueMethod;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user