I have lots of methods, which are almost the same, apart from the object name and the name of setters and getters.
What I would like to achieve is:
fill_DocLine(ResultSet rs, DocLine, [Index method, Input value ...
fill_DocLine(ResultSet rs, DocLine, [3, rs.getInt(1)], [4, rs.getString(2)], 6, rs.getInt(3)] ) {
DocLine refers to the Java Object to fill, and 3,4,6 refers to the indexes of the methods
DocLine line = new DocLine();
line.setNo(rs.getInt(1)); //method index 3 = setNo
line.setText(rs.getString(2)); //method index 4 = setText
line.setType(rs.getInt(3)); //method index 6 = setType
I heard of reflection, can I achieve this with reflection, if so how.
What I would like to achieve is:
fill_DocLine(ResultSet rs, DocLine, [Index method, Input value ...
fill_DocLine(ResultSet rs, DocLine, [3, rs.getInt(1)], [4, rs.getString(2)], 6, rs.getInt(3)] ) {
DocLine refers to the Java Object to fill, and 3,4,6 refers to the indexes of the methods
DocLine line = new DocLine();
line.setNo(rs.getInt(1)); //method index 3 = setNo
line.setText(rs.getString(2)); //method index 4 = setText
line.setType(rs.getInt(3)); //method index 6 = setType
I heard of reflection, can I achieve this with reflection, if so how.