This commit is contained in:
@@ -53,6 +53,7 @@ public interface Attribute<T, F> {
|
|||||||
public static <T, F> Attribute<T, F> create(String fieldname, final Field field) {
|
public static <T, F> Attribute<T, F> create(String fieldname, final Field field) {
|
||||||
return create((Class<T>) field.getDeclaringClass(), fieldname, field, null, null);
|
return create((Class<T>) field.getDeclaringClass(), fieldname, field, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据一个Class和field名生成 Attribute 对象。
|
* 根据一个Class和field名生成 Attribute 对象。
|
||||||
*
|
*
|
||||||
@@ -230,6 +231,7 @@ public interface Attribute<T, F> {
|
|||||||
mv.visitFieldInsn(GETFIELD, interName, field.getName(), Type.getDescriptor(pcolumn));
|
mv.visitFieldInsn(GETFIELD, interName, field.getName(), Type.getDescriptor(pcolumn));
|
||||||
if (pcolumn != column) {
|
if (pcolumn != column) {
|
||||||
mv.visitMethodInsn(INVOKESTATIC, columnName, "valueOf", "(" + Type.getDescriptor(pcolumn) + ")" + columnDesc, false);
|
mv.visitMethodInsn(INVOKESTATIC, columnName, "valueOf", "(" + Type.getDescriptor(pcolumn) + ")" + columnDesc, false);
|
||||||
|
m = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -257,6 +259,7 @@ public interface Attribute<T, F> {
|
|||||||
try {
|
try {
|
||||||
java.lang.reflect.Method pm = column.getMethod(pcolumn.getSimpleName() + "Value");
|
java.lang.reflect.Method pm = column.getMethod(pcolumn.getSimpleName() + "Value");
|
||||||
mv.visitMethodInsn(INVOKEVIRTUAL, columnName, pm.getName(), Type.getMethodDescriptor(pm), false);
|
mv.visitMethodInsn(INVOKEVIRTUAL, columnName, pm.getName(), Type.getMethodDescriptor(pm), false);
|
||||||
|
m = 3;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw new RuntimeException(ex); //不可能会发生
|
throw new RuntimeException(ex); //不可能会发生
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user