mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-13 00:15:24 +00:00
fix[entity wrapper]: box type not match error
This commit is contained in:
1 parent
76ee8f310e
commit
b1d5afb631
1 file changed
+2
-2
@@ -47,7 +47,7 @@ public abstract class EnhanceUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static String rawObjectId(Field idField) {
|
||||
public static String toOriginType(Field idField) {
|
||||
var idType = idField.getType();
|
||||
if (idType == int.class) {
|
||||
return "((Integer)$1).intValue()";
|
||||
@@ -91,7 +91,7 @@ public abstract class EnhanceUtils {
|
||||
// 定义类实现的接口方法newEntity
|
||||
CtMethod newEntityMethod = new CtMethod(classPool.get(IEntity.class.getName()), "newEntity", classPool.get(new String[]{Comparable.class.getName()}), enhanceClazz);
|
||||
newEntityMethod.setModifiers(Modifier.PUBLIC + Modifier.FINAL);
|
||||
String newEntityMethodBody = StringUtils.format("{ {} entity = new {}(); entity.{}({}); return entity; }", clazz.getName(), clazz.getName(), setIdMethod.getName(), rawObjectId(idField));
|
||||
String newEntityMethodBody = StringUtils.format("{ {} entity = new {}(); entity.{}({}); return entity; }", clazz.getName(), clazz.getName(), setIdMethod.getName(), toOriginType(idField));
|
||||
newEntityMethod.setBody(newEntityMethodBody);
|
||||
enhanceClazz.addMethod(newEntityMethod);
|
||||
|
||||
|
||||
Reference in new issue
Block a user