java - 如何使用 Get Metod 从海量中提取价值?
问题描述
我有这个代码
public void insertStart_auto_load_test_step_info(int countUsers ) throws SQLException{
String insert_auto_load_test_user_info = "insert into auto_load_test_step_info(id_user_info,start_time,step_id) values(" + getIdValue1()+ getCrokStarTime() + "2";
PreparedStatement pstmt = this.con.prepareStatement(insert_auto_load_test_user_info, Statement.RETURN_GENERATED_KEYS);
pstmt.executeUpdate();
而这堂课
public class Info {
private int crok = 0;
private int testId = 0;
private int testCaseId = 1;
private long starTime;
private long crokStarTime;
private long crokFinishTime;
int [] idValue1 = new int[100];
int [] idValue2 = new int[100];
int id_case_info = 0;
public int[] getIdValue2() {
return idValue2;
}
public void setIdValue2(int idValue2, int i) {
this.idValue2[i] = idValue2;
}
public int getId_case_info() {
return id_case_info;
}
public void setId_case_info(int id_case_info) {
this.id_case_info = id_case_info;
}
public int[] getIdValue1() {
return idValue1;
}
public void setIdValue1(int idValue1, int i) {
this.idValue1[i] = idValue1;
}
我需要从此方法添加到我的插入值,getIdValue1()
我该怎么做?我认为,必须有某种索引,但我不知道如何使用它。
解决方案
在您的 setIdValue2() 方法之后对其进行建模。
// You should check, somewhere, that i is a valid index of idValue2
public int getIdValue2(int i) {
return idValue2[i];
}
现在,您可以调用您的方法:int temp = getIdValue2(0); // Get item at first index
推荐阅读
- javascript - How to handle glitch while moving div using position attributes via arrow keys?
- javascript - IntersectionObserver API and TypeScript
- javascript - How can I fix the offset of the gradient to be aligned with the chart points(chart.js)?
- java - 在“foreach”项目中使用“选择”项目时捕获 NoSuchPropertyException 异常
- c# - 在 mv 到其他目录之后,Dotnet CLI 无法构建?
- sequelize.js - Sequelize.js model.schema 包含
- javascript - 如何在功能组件中使用 Flow 检查道具,以便我可以直接使用道具变量?
- javascript - 如何在 OpenSeadragon 中旋转后获取图像角位置
- python - 为什么 Python 中的引用计数被认为不是线程安全的?
- typescript - 打字稿,如何摆脱这些开关语句