1 10 11 package com.triactive.jdo.state; 12 13 import com.triactive.jdo.FieldManager; 14 15 16 27 28 class SCOWrapper implements FieldManager 29 { 30 private final FieldManager fm; 31 private final StateManagerImpl sm; 32 private final boolean[] isSCO; 33 34 35 46 47 public SCOWrapper(FieldManager fm, StateManagerImpl sm, boolean[] isSCO) 48 { 49 this.fm = fm; 50 this.sm = sm; 51 this.isSCO = isSCO; 52 } 53 54 public void storeBooleanField(int field, boolean value) 55 { 56 fm.storeBooleanField(field, value); 57 } 58 59 public boolean fetchBooleanField(int field) 60 { 61 return fm.fetchBooleanField(field); 62 } 63 64 public void storeCharField(int field, char value) 65 { 66 fm.storeCharField(field, value); 67 } 68 69 public char fetchCharField(int field) 70 { 71 return fm.fetchCharField(field); 72 } 73 74 public void storeByteField(int field, byte value) 75 { 76 fm.storeByteField(field, value); 77 } 78 79 public byte fetchByteField(int field) 80 { 81 return fm.fetchByteField(field); 82 } 83 84 public void storeShortField(int field, short value) 85 { 86 fm.storeShortField(field, value); 87 } 88 89 public short fetchShortField(int field) 90 { 91 return fm.fetchShortField(field); 92 } 93 94 public void storeIntField(int field, int value) 95 { 96 fm.storeIntField(field, value); 97 } 98 99 public int fetchIntField(int field) 100 { 101 return fm.fetchIntField(field); 102 } 103 104 public void storeLongField(int field, long value) 105 { 106 fm.storeLongField(field, value); 107 } 108 109 public long fetchLongField(int field) 110 { 111 return fm.fetchLongField(field); 112 } 113 114 public void storeFloatField(int field, float value) 115 { 116 fm.storeFloatField(field, value); 117 } 118 119 public float fetchFloatField(int field) 120 { 121 return fm.fetchFloatField(field); 122 } 123 124 public void storeDoubleField(int field, double value) 125 { 126 fm.storeDoubleField(field, value); 127 } 128 129 public double fetchDoubleField(int field) 130 { 131 return fm.fetchDoubleField(field); 132 } 133 134 public void storeStringField(int field, String value) 135 { 136 fm.storeStringField(field, value); 137 } 138 139 public String fetchStringField(int field) 140 { 141 return fm.fetchStringField(field); 142 } 143 144 public void storeObjectField(int field, Object value) 145 { 146 fm.storeObjectField(field, value); 147 } 148 149 public Object fetchObjectField(int field) 150 { 151 Object value = fm.fetchObjectField(field); 152 153 if (isSCO[field]) 154 return sm.wrapSCOInstance(field, value); 155 else 156 return value; 157 } 158 } 159 | Popular Tags |