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.PreparedStatement ; 16 17 18 class ParameterSetter extends AbstractFieldManager 19 { 20 private final PersistenceManager pm; 21 private final PreparedStatement ps; 22 private final ColumnMapping[] mappings; 23 private final int[] paramNumbersByField; 24 25 public ParameterSetter(PersistenceManager pm, 26 PreparedStatement ps, 27 ColumnMapping[] mappings, 28 int[] paramNumbersByField) 29 { 30 this.pm = pm; 31 this.ps = ps; 32 this.mappings = mappings; 33 this.paramNumbersByField = paramNumbersByField; 34 } 35 36 public void storeBooleanField(int fieldNumber, boolean value) 37 { 38 mappings[fieldNumber].setBoolean(pm, ps, paramNumbersByField[fieldNumber], value); 39 } 40 41 public void storeCharField(int fieldNumber, char value) 42 { 43 mappings[fieldNumber].setChar(pm, ps, paramNumbersByField[fieldNumber], value); 44 } 45 46 public void storeByteField(int fieldNumber, byte value) 47 { 48 mappings[fieldNumber].setByte(pm, ps, paramNumbersByField[fieldNumber], value); 49 } 50 51 public void storeShortField(int fieldNumber, short value) 52 { 53 mappings[fieldNumber].setShort(pm, ps, paramNumbersByField[fieldNumber], value); 54 } 55 56 public void storeIntField(int fieldNumber, int value) 57 { 58 mappings[fieldNumber].setInt(pm, ps, paramNumbersByField[fieldNumber], value); 59 } 60 61 public void storeLongField(int fieldNumber, long value) 62 { 63 mappings[fieldNumber].setLong(pm, ps, paramNumbersByField[fieldNumber], value); 64 } 65 66 public void storeFloatField(int fieldNumber, float value) 67 { 68 mappings[fieldNumber].setFloat(pm, ps, paramNumbersByField[fieldNumber], value); 69 } 70 71 public void storeDoubleField(int fieldNumber, double value) 72 { 73 mappings[fieldNumber].setDouble(pm, ps, paramNumbersByField[fieldNumber], value); 74 } 75 76 public void storeStringField(int fieldNumber, String value) 77 { 78 mappings[fieldNumber].setString(pm, ps, paramNumbersByField[fieldNumber], value); 79 } 80 81 public void storeObjectField(int fieldNumber, Object value) 82 { 83 mappings[fieldNumber].setObject(pm, ps, paramNumbersByField[fieldNumber], value); 84 } 85 } 86 | Popular Tags |