EntityFullFunc

This commit is contained in:
redkale
2024-09-26 08:32:52 +08:00
parent 4028c9a465
commit 78ba874dbf
6 changed files with 291 additions and 91 deletions

View File

@@ -21,151 +21,341 @@ public interface DataResultSetRow {
// 可以为空
public @Nullable EntityInfo getEntityInfo();
// columnIdex从1开始
public Object getObject(int columnIdex);
/**
* 根据字段序号获取字段值, index从1开始
*
* @param columnIndex 字段序号
* @return 字段值
*/
public Object getObject(int columnIndex);
/**
* 根据字段名获取字段值
*
* @param columnLabel 字段名
* @return 字段值
*/
public Object getObject(String columnLabel);
// columnIdex从1开始
/**
* 根据字段序号获取字段值, index从1开始
*
* @param <T> 泛型
* @param attr Attribute
* @param columnIndex 字段序号
* @param columnLabel 字段名
* @return 字段值
*/
default <T> Serializable getObject(Attribute<T, Serializable> attr, int columnIndex, String columnLabel) {
return DataResultSet.getRowColumnValue(this, attr, columnIndex, columnLabel);
}
// columnIdex从1开始
/**
* 根据字段序号获取字段值, index从1开始
*
* @param columnIndex 字段序号
* @return 字段值
*/
@ClassDepends
public String getString(int columnIdex);
public String getString(int columnIndex);
/**
* 根据字段名获取字段值
*
* @param columnLabel 字段名
* @return 字段值
*/
@ClassDepends
public String getString(String columnLabel);
// columnIdex从1开始
/**
* 根据字段序号获取字段值, index从1开始
*
* @param columnIndex 字段序号
* @return 字段值
*/
@ClassDepends
public byte[] getBytes(int columnIdex);
public byte[] getBytes(int columnIndex);
/**
* 根据字段名获取字段值
*
* @param columnLabel 字段名
* @return 字段值
*/
@ClassDepends
public byte[] getBytes(String columnLabel);
// columnIdex从1开始
/**
* 根据字段序号获取字段值, index从1开始
*
* @param columnIndex 字段序号
* @return 字段值
*/
@ClassDepends
public BigDecimal getBigDecimal(int columnIdex);
public BigDecimal getBigDecimal(int columnIndex);
/**
* 根据字段名获取字段值
*
* @param columnLabel 字段名
* @return 字段值
*/
@ClassDepends
public BigDecimal getBigDecimal(String columnLabel);
// columnIdex从1开始
/**
* 根据字段序号获取字段值, index从1开始
*
* @param columnIndex 字段序号
* @return 字段值
*/
@ClassDepends
public Boolean getBoolean(int columnIdex);
public Boolean getBoolean(int columnIndex);
/**
* 根据字段名获取字段值
*
* @param columnLabel 字段名
* @return 字段值
*/
@ClassDepends
public Boolean getBoolean(String columnLabel);
// columnIdex从1开始
/**
* 根据字段序号获取字段值, index从1开始
*
* @param columnIndex 字段序号
* @return 字段值
*/
@ClassDepends
public Short getShort(int columnIdex);
public Short getShort(int columnIndex);
/**
* 根据字段名获取字段值
*
* @param columnLabel 字段名
* @return 字段值
*/
@ClassDepends
public Short getShort(String columnLabel);
// columnIdex从1开始
/**
* 根据字段序号获取字段值, index从1开始
*
* @param columnIndex 字段序号
* @return 字段值
*/
@ClassDepends
public Integer getInteger(int columnIdex);
public Integer getInteger(int columnIndex);
/**
* 根据字段名获取字段值
*
* @param columnLabel 字段名
* @return 字段值
*/
@ClassDepends
public Integer getInteger(String columnLabel);
// columnIdex从1开始
/**
* 根据字段序号获取字段值, index从1开始
*
* @param columnIndex 字段序号
* @return 字段值
*/
@ClassDepends
public Float getFloat(int columnIdex);
public Float getFloat(int columnIndex);
/**
* 根据字段名获取字段值
*
* @param columnLabel 字段名
* @return 字段值
*/
@ClassDepends
public Float getFloat(String columnLabel);
// columnIdex从1开始
/**
* 根据字段序号获取字段值, index从1开始
*
* @param columnIndex 字段序号
* @return 字段值
*/
@ClassDepends
public Long getLong(int columnIdex);
public Long getLong(int columnIndex);
/**
* 根据字段名获取字段值
*
* @param columnLabel 字段名
* @return 字段值
*/
@ClassDepends
public Long getLong(String columnLabel);
// columnIdex从1开始
/**
* 根据字段序号获取字段值, index从1开始
*
* @param columnIndex 字段序号
* @return 字段值
*/
@ClassDepends
public Double getDouble(int columnIdex);
public Double getDouble(int columnIndex);
/**
* 根据字段名获取字段值
*
* @param columnLabel 字段名
* @return 字段值
*/
@ClassDepends
public Double getDouble(String columnLabel);
// columnIdex从1开始
/**
* 根据字段序号获取字段值, index从1开始
*
* @param columnIndex 字段序号
* @param defValue 默认值
* @return 字段值
*/
@ClassDepends
default boolean getBoolean(int columnIdex, boolean defValue) {
Boolean val = getBoolean(columnIdex);
default boolean getBoolean(int columnIndex, boolean defValue) {
Boolean val = getBoolean(columnIndex);
return val == null ? defValue : val;
}
/**
* 根据字段名获取字段值
*
* @param columnLabel 字段名
* @param defValue 默认值
* @return 字段值
*/
@ClassDepends
default boolean getBoolean(String columnLabel, boolean defValue) {
Boolean val = getBoolean(columnLabel);
return val == null ? defValue : val;
}
// columnIdex从1开始
/**
* 根据字段序号获取字段值, index从1开始
*
* @param columnIndex 字段序号
* @param defValue 默认值
* @return 字段值
*/
@ClassDepends
default short getShort(int columnIdex, short defValue) {
Short val = getShort(columnIdex);
default short getShort(int columnIndex, short defValue) {
Short val = getShort(columnIndex);
return val == null ? defValue : val;
}
/**
* 根据字段名获取字段值
*
* @param columnLabel 字段名
* @param defValue 默认值
* @return 字段值
*/
@ClassDepends
default short getShort(String columnLabel, short defValue) {
Short val = getShort(columnLabel);
return val == null ? defValue : val;
}
// columnIdex从1开始
/**
* 根据字段序号获取字段值, index从1开始
*
* @param columnIndex 字段序号
* @param defValue 默认值
* @return 字段值
*/
@ClassDepends
default int getInteger(int columnIdex, int defValue) {
Integer val = getInteger(columnIdex);
default int getInteger(int columnIndex, int defValue) {
Integer val = getInteger(columnIndex);
return val == null ? defValue : val;
}
/**
* 根据字段名获取字段值
*
* @param columnLabel 字段名
* @param defValue 默认值
* @return 字段值
*/
@ClassDepends
default int getInteger(String columnLabel, int defValue) {
Integer val = getInteger(columnLabel);
return val == null ? defValue : val;
}
// columnIdex从1开始
/**
* 根据字段序号获取字段值, index从1开始
*
* @param columnIndex 字段序号
* @param defValue 默认值
* @return 字段值
*/
@ClassDepends
default float getFloat(int columnIdex, float defValue) {
Float val = getFloat(columnIdex);
default float getFloat(int columnIndex, float defValue) {
Float val = getFloat(columnIndex);
return val == null ? defValue : val;
}
/**
* 根据字段名获取字段值
*
* @param columnLabel 字段名
* @param defValue 默认值
* @return 字段值
*/
@ClassDepends
default float getFloat(String columnLabel, float defValue) {
Float val = getFloat(columnLabel);
return val == null ? defValue : val;
}
// columnIdex从1开始
/**
* 根据字段序号获取字段值, index从1开始
*
* @param columnIndex 字段序号
* @param defValue 默认值
* @return 字段值
*/
@ClassDepends
default long getLong(int columnIdex, long defValue) {
Long val = getLong(columnIdex);
default long getLong(int columnIndex, long defValue) {
Long val = getLong(columnIndex);
return val == null ? defValue : val;
}
/**
* 根据字段名获取字段值
*
* @param columnLabel 字段名
* @param defValue 默认值
* @return 字段值
*/
@ClassDepends
default long getLong(String columnLabel, long defValue) {
Long val = getLong(columnLabel);
return val == null ? defValue : val;
}
// columnIdex从1开始
/**
* 根据字段序号获取字段值, index从1开始
*
* @param columnIndex 字段序号
* @param defValue 默认值
* @return 字段值
*/
@ClassDepends
default double getDouble(int columnIdex, double defValue) {
Double val = getDouble(columnIdex);
default double getDouble(int columnIndex, double defValue) {
Double val = getDouble(columnIndex);
return val == null ? defValue : val;
}
/**
* 根据字段名获取字段值
*
* @param columnLabel 字段名
* @param defValue 默认值
* @return 字段值
*/
@ClassDepends
default double getDouble(String columnLabel, double defValue) {
Double val = getDouble(columnLabel);

View File

@@ -148,7 +148,7 @@ public abstract class EntityFullFunc<T> {
mv.visitVarInsn(ASTORE, 2);
for (int i = 0; i < attrs.length; i++) {
final int attrIndex = i;
final int colIndex = i + 1;
final Attribute<T, Serializable> attr = attrs[i];
java.lang.reflect.Method setter = null;
java.lang.reflect.Field field = null;
@@ -170,7 +170,7 @@ public abstract class EntityFullFunc<T> {
String desc = Type.getMethodDescriptor(setter);
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitInsn(ICONST_0);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getBoolean", "(IZ)Z", true);
mv.visitMethodInsn(INVOKEVIRTUAL, entityName, setter.getName(), desc, false);
@@ -178,7 +178,7 @@ public abstract class EntityFullFunc<T> {
} else if (field != null) {
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitInsn(ICONST_0);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getBoolean", "(IZ)Z", true);
mv.visitFieldInsn(PUTFIELD, entityName, field.getName(), "Z");
@@ -189,7 +189,7 @@ public abstract class EntityFullFunc<T> {
String desc = Type.getMethodDescriptor(setter);
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitInsn(ICONST_0);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getShort", "(IS)S", true);
mv.visitMethodInsn(INVOKEVIRTUAL, entityName, setter.getName(), desc, false);
@@ -197,7 +197,7 @@ public abstract class EntityFullFunc<T> {
} else if (field != null) {
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitInsn(ICONST_0);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getShort", "(IS)S", true);
mv.visitFieldInsn(PUTFIELD, entityName, field.getName(), "S");
@@ -208,7 +208,7 @@ public abstract class EntityFullFunc<T> {
String desc = Type.getMethodDescriptor(setter);
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitInsn(ICONST_0);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getInteger", "(II)I", true);
mv.visitMethodInsn(INVOKEVIRTUAL, entityName, setter.getName(), desc, false);
@@ -216,7 +216,7 @@ public abstract class EntityFullFunc<T> {
} else if (field != null) {
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitInsn(ICONST_0);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getInteger", "(II)I", true);
mv.visitFieldInsn(PUTFIELD, entityName, field.getName(), "I");
@@ -227,7 +227,7 @@ public abstract class EntityFullFunc<T> {
String desc = Type.getMethodDescriptor(setter);
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitInsn(FCONST_0);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getFloat", "(IF)F", true);
mv.visitMethodInsn(INVOKEVIRTUAL, entityName, setter.getName(), desc, false);
@@ -235,7 +235,7 @@ public abstract class EntityFullFunc<T> {
} else if (field != null) {
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitInsn(FCONST_0);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getFloat", "(IF)F", true);
mv.visitFieldInsn(PUTFIELD, entityName, field.getName(), "F");
@@ -246,7 +246,7 @@ public abstract class EntityFullFunc<T> {
String desc = Type.getMethodDescriptor(setter);
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitInsn(LCONST_0);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getLong", "(IJ)J", true);
mv.visitMethodInsn(INVOKEVIRTUAL, entityName, setter.getName(), desc, false);
@@ -254,7 +254,7 @@ public abstract class EntityFullFunc<T> {
} else if (field != null) {
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitInsn(LCONST_0);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getLong", "(IJ)J", true);
mv.visitFieldInsn(PUTFIELD, entityName, field.getName(), "J");
@@ -265,7 +265,7 @@ public abstract class EntityFullFunc<T> {
String desc = Type.getMethodDescriptor(setter);
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitInsn(DCONST_0);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getDouble", "(ID)D", true);
mv.visitMethodInsn(INVOKEVIRTUAL, entityName, setter.getName(), desc, false);
@@ -273,7 +273,7 @@ public abstract class EntityFullFunc<T> {
} else if (field != null) {
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitInsn(DCONST_0);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getDouble", "(ID)D", true);
mv.visitFieldInsn(PUTFIELD, entityName, field.getName(), "D");
@@ -284,14 +284,14 @@ public abstract class EntityFullFunc<T> {
String desc = Type.getMethodDescriptor(setter);
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getBoolean", "(I)Ljava/lang/Boolean;", true);
mv.visitMethodInsn(INVOKEVIRTUAL, entityName, setter.getName(), desc, false);
continue;
} else if (field != null) {
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getBoolean", "(I)Ljava/lang/Boolean;", true);
mv.visitFieldInsn(PUTFIELD, entityName, field.getName(), "Ljava/lang/Boolean;");
continue;
@@ -301,14 +301,14 @@ public abstract class EntityFullFunc<T> {
String desc = Type.getMethodDescriptor(setter);
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getShort", "(I)Ljava/lang/Short;", true);
mv.visitMethodInsn(INVOKEVIRTUAL, entityName, setter.getName(), desc, false);
continue;
} else if (field != null) {
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getShort", "(I)Ljava/lang/Short;", true);
mv.visitFieldInsn(PUTFIELD, entityName, field.getName(), "Ljava/lang/Short;");
continue;
@@ -318,14 +318,14 @@ public abstract class EntityFullFunc<T> {
String desc = Type.getMethodDescriptor(setter);
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getInteger", "(I)Ljava/lang/Integer;", true);
mv.visitMethodInsn(INVOKEVIRTUAL, entityName, setter.getName(), desc, false);
continue;
} else if (field != null) {
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getInteger", "(I)Ljava/lang/Integer;", true);
mv.visitFieldInsn(PUTFIELD, entityName, field.getName(), "Ljava/lang/Integer;");
continue;
@@ -335,14 +335,14 @@ public abstract class EntityFullFunc<T> {
String desc = Type.getMethodDescriptor(setter);
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getFloat", "(I)Ljava/lang/Float;", true);
mv.visitMethodInsn(INVOKEVIRTUAL, entityName, setter.getName(), desc, false);
continue;
} else if (field != null) {
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getFloat", "(I)Ljava/lang/Float;", true);
mv.visitFieldInsn(PUTFIELD, entityName, field.getName(), "Ljava/lang/Float;");
continue;
@@ -352,14 +352,14 @@ public abstract class EntityFullFunc<T> {
String desc = Type.getMethodDescriptor(setter);
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getLong", "(I)Ljava/lang/Long;", true);
mv.visitMethodInsn(INVOKEVIRTUAL, entityName, setter.getName(), desc, false);
continue;
} else if (field != null) {
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getLong", "(I)Ljava/lang/Long;", true);
mv.visitFieldInsn(PUTFIELD, entityName, field.getName(), "Ljava/lang/Long;");
continue;
@@ -369,14 +369,14 @@ public abstract class EntityFullFunc<T> {
String desc = Type.getMethodDescriptor(setter);
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getDouble", "(I)Ljava/lang/Double;", true);
mv.visitMethodInsn(INVOKEVIRTUAL, entityName, setter.getName(), desc, false);
continue;
} else if (field != null) {
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getDouble", "(I)Ljava/lang/Double;", true);
mv.visitFieldInsn(PUTFIELD, entityName, field.getName(), "Ljava/lang/Double;");
continue;
@@ -386,14 +386,14 @@ public abstract class EntityFullFunc<T> {
String desc = Type.getMethodDescriptor(setter);
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getString", "(I)Ljava/lang/String;", true);
mv.visitMethodInsn(INVOKEVIRTUAL, entityName, setter.getName(), desc, false);
continue;
} else if (field != null) {
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getString", "(I)Ljava/lang/String;", true);
mv.visitFieldInsn(PUTFIELD, entityName, field.getName(), "Ljava/lang/String;");
continue;
@@ -403,14 +403,14 @@ public abstract class EntityFullFunc<T> {
String desc = Type.getMethodDescriptor(setter);
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getBytes", "(I)[B", true);
mv.visitMethodInsn(INVOKEVIRTUAL, entityName, setter.getName(), desc, false);
continue;
} else if (field != null) {
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitMethodInsn(INVOKEINTERFACE, rowName, "getBytes", "(I)[B", true);
mv.visitFieldInsn(PUTFIELD, entityName, field.getName(), "[B");
continue;
@@ -420,7 +420,7 @@ public abstract class EntityFullFunc<T> {
String desc = Type.getMethodDescriptor(setter);
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitMethodInsn(
INVOKEINTERFACE, rowName, "getBigDecimal", "(I)Ljava/math/BigDecimal;", true);
mv.visitMethodInsn(INVOKEVIRTUAL, entityName, setter.getName(), desc, false);
@@ -428,7 +428,7 @@ public abstract class EntityFullFunc<T> {
} else if (field != null) {
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitVarInsn(ALOAD, 1); // row
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex);
mv.visitMethodInsn(
INVOKEINTERFACE, rowName, "getBigDecimal", "(I)Ljava/math/BigDecimal;", true);
mv.visitFieldInsn(PUTFIELD, entityName, field.getName(), "Ljava/math/BigDecimal;");
@@ -436,7 +436,7 @@ public abstract class EntityFullFunc<T> {
}
}
mv.visitVarInsn(ALOAD, 0);
Asms.visitInsn(mv, attrIndex);
Asms.visitInsn(mv, colIndex - 1);
mv.visitVarInsn(ALOAD, 1); // row
mv.visitVarInsn(ALOAD, 2); // obj
mv.visitMethodInsn(

View File

@@ -2,7 +2,7 @@
* Copyright (c) 2016-2116 Redkale
* All rights reserved.
*/
package org.redkale.test.source;
package org.redkale.test.source.func;
import java.math.BigDecimal;
import java.util.List;
@@ -50,7 +50,8 @@ public class EntityFullFuncTest {
}
@Override
public Object getObject(int columnIdex) {
public Object getObject(int columnIndex) {
if (columnIndex < 1) throw new IllegalArgumentException();
return null;
}
@@ -60,7 +61,8 @@ public class EntityFullFuncTest {
}
@Override
public String getString(int columnIdex) {
public String getString(int columnIndex) {
if (columnIndex < 1) throw new IllegalArgumentException();
return "mystring";
}
@@ -70,7 +72,8 @@ public class EntityFullFuncTest {
}
@Override
public byte[] getBytes(int columnIdex) {
public byte[] getBytes(int columnIndex) {
if (columnIndex < 1) throw new IllegalArgumentException();
return null;
}
@@ -80,7 +83,8 @@ public class EntityFullFuncTest {
}
@Override
public BigDecimal getBigDecimal(int columnIdex) {
public BigDecimal getBigDecimal(int columnIndex) {
if (columnIndex < 1) throw new IllegalArgumentException();
return BigDecimal.ZERO;
}
@@ -90,7 +94,8 @@ public class EntityFullFuncTest {
}
@Override
public Boolean getBoolean(int columnIdex) {
public Boolean getBoolean(int columnIndex) {
if (columnIndex < 1) throw new IllegalArgumentException();
return true;
}
@@ -100,7 +105,8 @@ public class EntityFullFuncTest {
}
@Override
public Short getShort(int columnIdex) {
public Short getShort(int columnIndex) {
if (columnIndex < 1) throw new IllegalArgumentException();
return 111;
}
@@ -110,7 +116,8 @@ public class EntityFullFuncTest {
}
@Override
public Integer getInteger(int columnIdex) {
public Integer getInteger(int columnIndex) {
if (columnIndex < 1) throw new IllegalArgumentException();
return 222;
}
@@ -120,7 +127,8 @@ public class EntityFullFuncTest {
}
@Override
public Float getFloat(int columnIdex) {
public Float getFloat(int columnIndex) {
if (columnIndex < 1) throw new IllegalArgumentException();
return 333.f;
}
@@ -130,7 +138,8 @@ public class EntityFullFuncTest {
}
@Override
public Long getLong(int columnIdex) {
public Long getLong(int columnIndex) {
if (columnIndex < 1) throw new IllegalArgumentException();
return 444L;
}
@@ -140,7 +149,8 @@ public class EntityFullFuncTest {
}
@Override
public Double getDouble(int columnIdex) {
public Double getDouble(int columnIndex) {
if (columnIndex < 1) throw new IllegalArgumentException();
return 555.d;
}

View File

@@ -2,7 +2,7 @@
* Copyright (c) 2016-2116 Redkale
* All rights reserved.
*/
package org.redkale.test.source;
package org.redkale.test.source.func;
import java.math.BigDecimal;
import java.math.BigInteger;

View File

@@ -2,7 +2,7 @@
* Copyright (c) 2016-2116 Redkale
* All rights reserved.
*/
package org.redkale.test.source;
package org.redkale.test.source.func;
import java.math.BigDecimal;
import java.math.BigInteger;

View File

@@ -2,7 +2,7 @@
* Copyright (c) 2016-2116 Redkale
* All rights reserved.
*/
package org.redkale.test.source;
package org.redkale.test.source.func;
import java.io.Serializable;
import java.math.BigDecimal;