1 10 11 package com.triactive.jdo.store; 12 13 import com.triactive.jdo.AbstractFieldManager; 14 import com.triactive.jdo.PersistenceManager; 15 import java.sql.ResultSet ; 16 17 18 class ResultSetGetter extends AbstractFieldManager 19 { 20 private final PersistenceManager pm; 21 private final ResultSet rs; 22 private final ColumnMapping[] mappings; 23 private final int[] columnNumbersByField; 24 25 public ResultSetGetter(PersistenceManager pm, 26 ResultSet rs, 27 ColumnMapping[] mappings, 28 int[] columnNumbersByField) 29 { 30 this.pm = pm; 31 this.rs = rs; 32 this.mappings = mappings; 33 this.columnNumbersByField = columnNumbersByField; 34 } 35 36 public boolean fetchBooleanField(int fieldNumber) 37 { 38 return mappings[fieldNumber].getBoolean(pm, rs, columnNumbersByField[fieldNumber]); 39 } 40 41 public char fetchCharField(int fieldNumber) 42 { 43 return mappings[fieldNumber].getChar(pm, rs, columnNumbersByField[fieldNumber]); 44 } 45 46 public byte fetchByteField(int fieldNumber) 47 { 48 return mappings[fieldNumber].getByte(pm, rs, columnNumbersByField[fieldNumber]); 49 } 50 51 public short fetchShortField(int fieldNumber) 52 { 53 return mappings[fieldNumber].getShort(pm, rs, columnNumbersByField[fieldNumber]); 54 } 55 56 public int fetchIntField(int fieldNumber) 57 { 58 return mappings[fieldNumber].getInt(pm, rs, columnNumbersByField[fieldNumber]); 59 } 60 61 public long fetchLongField(int fieldNumber) 62 { 63 return mappings[fieldNumber].getLong(pm, rs, columnNumbersByField[fieldNumber]); 64 } 65 66 public float fetchFloatField(int fieldNumber) 67 { 68 return mappings[fieldNumber].getFloat(pm, rs, columnNumbersByField[fieldNumber]); 69 } 70 71 public double fetchDoubleField(int fieldNumber) 72 { 73 return mappings[fieldNumber].getDouble(pm, rs, columnNumbersByField[fieldNumber]); 74 } 75 76 public String fetchStringField(int fieldNumber) 77 { 78 return mappings[fieldNumber].getString(pm, rs, columnNumbersByField[fieldNumber]); 79 } 80 81 public Object fetchObjectField(int fieldNumber) 82 { 83 return mappings[fieldNumber].getObject(pm, rs, columnNumbersByField[fieldNumber]); 84 } 85 } 86 | Popular Tags |