18 package com.mysql.clusterj.core.metadata;
20 import com.mysql.clusterj.ClusterJFatalInternalException;
21 import com.mysql.clusterj.ColumnMetadata;
22 import com.mysql.clusterj.core.spi.ValueHandler;
23 import com.mysql.clusterj.core.spi.DomainTypeHandler;
24 import com.mysql.clusterj.core.util.I18NHelper;
25 import com.mysql.clusterj.core.util.Logger;
26 import com.mysql.clusterj.core.util.LoggerFactoryService;
27 import java.math.BigDecimal;
28 import java.math.BigInteger;
31 import java.sql.Timestamp;
41 private Object[] values;
44 private int numberOfFields;
47 this.values = keyValues;
48 this.numberOfFields = keyValues.length;
49 if (logger.isDetailEnabled()) {
51 for (
int i = 0;
i < values.length; ++
i) {
52 if (values[
i] != null) {
53 buffer.append(
" values[" +
i +
"]: \"" + values[
i] +
"\"");
56 logger.detail(
"KeyValueHandler<init> values.length: " + values.length + buffer.toString());
60 public boolean isNull(
int fieldNumber) {
61 return values[fieldNumber] == null;
64 public int getInt(
int fieldNumber) {
65 if (logger.isDetailEnabled()) logger.detail(
"KeyValueHandler.getInt(" + fieldNumber +
") returns: " + values[fieldNumber]);
66 return (Integer) values[fieldNumber];
69 public long getLong(
int fieldNumber) {
70 if (logger.isDetailEnabled()) logger.detail(
"KeyValueHandler.getLong(" + fieldNumber +
") returns: " + values[fieldNumber]);
71 return (Long) values[fieldNumber];
74 public Integer getObjectInt(
int fieldNumber) {
75 if (logger.isDetailEnabled()) logger.detail(
"KeyValueHandler.getObjectInt(" + fieldNumber +
") returns: " + values[fieldNumber]);
76 return (Integer) values[fieldNumber];
79 public Long getObjectLong(
int fieldNumber) {
80 if (logger.isDetailEnabled()) logger.detail(
"KeyValueHandler.getObjectLong(" + fieldNumber +
") returns: " + values[fieldNumber]);
81 return (Long) values[fieldNumber];
84 public String getString(
int fieldNumber) {
85 if (logger.isDetailEnabled()) logger.detail(
"KeyValueHandler.getString(" + fieldNumber +
") returns: " + values[fieldNumber]);
86 return (
String) values[fieldNumber];
89 public boolean isModified(
int fieldNumber) {
90 throw new UnsupportedOperationException(
91 local.
message(
"ERR_Operation_Not_Supported",
92 "isModified",
"KeyValueHandlerImpl"));
95 public BigInteger getBigInteger(
int fieldNumber) {
97 local.
message(
"ERR_Operation_Not_Supported",
98 "getBigInteger",
"KeyValueHandlerImpl"));
101 public boolean getBoolean(
int fieldNumber) {
103 local.
message(
"ERR_Operation_Not_Supported",
104 "getBoolean",
"KeyValueHandlerImpl"));
107 public boolean[] getBooleans(
int fieldNumber) {
109 local.
message(
"ERR_Operation_Not_Supported",
110 "getBooleans",
"KeyValueHandlerImpl"));
113 public byte getByte(
int fieldNumber) {
115 local.
message(
"ERR_Operation_Not_Supported",
116 "getByte",
"KeyValueHandlerImpl"));
119 public byte[] getBytes(
int fieldNumber) {
120 if (logger.isDetailEnabled()) logger.detail(
"KeyValueHandler.getBytes(" + fieldNumber +
") returns: " + values[fieldNumber]);
121 return (byte[]) values[fieldNumber];
124 public short getShort(
int fieldNumber) {
126 local.
message(
"ERR_Operation_Not_Supported",
127 "getShort",
"KeyValueHandlerImpl"));
130 public float getFloat(
int fieldNumber) {
132 local.
message(
"ERR_Operation_Not_Supported",
133 "getFloat",
"KeyValueHandlerImpl"));
136 public double getDouble(
int fieldNumber) {
138 local.
message(
"ERR_Operation_Not_Supported",
139 "getDouble",
"KeyValueHandlerImpl"));
142 public Boolean getObjectBoolean(
int fieldNumber) {
144 local.
message(
"ERR_Operation_Not_Supported",
145 "getObjectBoolean",
"KeyValueHandlerImpl"));
148 public Byte getObjectByte(
int fieldNumber) {
150 local.
message(
"ERR_Operation_Not_Supported",
151 "getObjectByte",
"KeyValueHandlerImpl"));
154 public Short getObjectShort(
int fieldNumber) {
156 local.
message(
"ERR_Operation_Not_Supported",
157 "getObjectShort",
"KeyValueHandlerImpl"));
160 public Float getObjectFloat(
int fieldNumber) {
162 local.
message(
"ERR_Operation_Not_Supported",
163 "getObjectFloat",
"KeyValueHandlerImpl"));
166 public Double getObjectDouble(
int fieldNumber) {
168 local.
message(
"ERR_Operation_Not_Supported",
169 "getObjectDouble",
"KeyValueHandlerImpl"));
172 public BigDecimal getBigDecimal(
int fieldNumber) {
174 local.
message(
"ERR_Operation_Not_Supported",
175 "getBigDecimal",
"KeyValueHandlerImpl"));
178 public Date getJavaSqlDate(
int fieldNumber) {
180 local.
message(
"ERR_Operation_Not_Supported",
181 "getJavaSqlDate",
"KeyValueHandlerImpl"));
184 public java.util.Date getJavaUtilDate(
int fieldNumber) {
186 local.
message(
"ERR_Operation_Not_Supported",
187 "getJavaUtilDate",
"KeyValueHandlerImpl"));
190 public Time getJavaSqlTime(
int fieldNumber) {
192 local.
message(
"ERR_Operation_Not_Supported",
193 "getJavaSqlTime",
"KeyValueHandlerImpl"));
196 public Timestamp getJavaSqlTimestamp(
int fieldNumber) {
198 local.
message(
"ERR_Operation_Not_Supported",
199 "getJavaSqlTimestamp",
"KeyValueHandlerImpl"));
202 public void setBoolean(
int fieldNumber,
boolean b) {
204 local.
message(
"ERR_Operation_Not_Supported",
205 "setBoolean",
"KeyValueHandlerImpl"));
208 public void setBooleans(
int fieldNumber,
boolean[] b) {
210 local.
message(
"ERR_Operation_Not_Supported",
211 "setBooleans",
"KeyValueHandlerImpl"));
214 public void setBigInteger(
int fieldNumber, BigInteger value) {
216 local.
message(
"ERR_Operation_Not_Supported",
217 "setBigInteger",
"KeyValueHandlerImpl"));
220 public void setByte(
int fieldNumber, byte value) {
222 local.
message(
"ERR_Operation_Not_Supported",
223 "setByte",
"KeyValueHandlerImpl"));
226 public void setBytes(
int fieldNumber, byte[] value) {
228 local.
message(
"ERR_Operation_Not_Supported",
229 "setBytes",
"KeyValueHandlerImpl"));
232 public void setShort(
int fieldNumber,
short value) {
234 local.
message(
"ERR_Operation_Not_Supported",
235 "setShort",
"KeyValueHandlerImpl"));
238 public void setInt(
int fieldNumber,
int value) {
240 local.
message(
"ERR_Operation_Not_Supported",
241 "setInt",
"KeyValueHandlerImpl"));
244 public void setLong(
int fieldNumber,
long value) {
246 local.
message(
"ERR_Operation_Not_Supported",
247 "setLong",
"KeyValueHandlerImpl"));
250 public void setFloat(
int fieldNumber,
float value) {
252 local.
message(
"ERR_Operation_Not_Supported",
253 "setFloat",
"KeyValueHandlerImpl"));
256 public void setDouble(
int fieldNumber,
double value) {
258 local.
message(
"ERR_Operation_Not_Supported",
259 "setDouble",
"KeyValueHandlerImpl"));
262 public void setObjectBoolean(
int fieldNumber, Boolean value) {
264 local.
message(
"ERR_Operation_Not_Supported",
265 "setObjectBoolean",
"KeyValueHandlerImpl"));
268 public void setObjectByte(
int fieldNumber, Byte value) {
270 local.
message(
"ERR_Operation_Not_Supported",
271 "setObjectByte",
"KeyValueHandlerImpl"));
274 public void setObjectShort(
int fieldNumber, Short value) {
276 local.
message(
"ERR_Operation_Not_Supported",
277 "setObjectShort",
"KeyValueHandlerImpl"));
280 public void setObjectInt(
int fieldNumber, Integer value) {
282 local.
message(
"ERR_Operation_Not_Supported",
283 "setObjectInt",
"KeyValueHandlerImpl"));
286 public void setObjectLong(
int fieldNumber, Long value) {
288 local.
message(
"ERR_Operation_Not_Supported",
289 "setObjectLong",
"KeyValueHandlerImpl"));
292 public void setObjectFloat(
int fieldNumber, Float value) {
294 local.
message(
"ERR_Operation_Not_Supported",
295 "setObjectFloat",
"KeyValueHandlerImpl"));
298 public void setObjectDouble(
int fieldNumber, Double value) {
300 local.
message(
"ERR_Operation_Not_Supported",
301 "setObjectDouble",
"KeyValueHandlerImpl"));
304 public void setBigDecimal(
int fieldNumber, BigDecimal value) {
306 local.
message(
"ERR_Operation_Not_Supported",
307 "setBigDecimal",
"KeyValueHandlerImpl"));
310 public void setString(
int fieldNumber,
String value) {
312 local.
message(
"ERR_Operation_Not_Supported",
313 "setString",
"KeyValueHandlerImpl"));
316 public void setObject(
int fieldNumber, Object value) {
318 local.
message(
"ERR_Operation_Not_Supported",
319 "setObject",
"KeyValueHandlerImpl"));
322 public void setJavaSqlDate(
int fieldNumber, Date value) {
324 local.
message(
"ERR_Operation_Not_Supported",
325 "setJavaSqlDate",
"KeyValueHandlerImpl"));
328 public void setJavaUtilDate(
int fieldNumber, java.util.Date value) {
330 local.
message(
"ERR_Operation_Not_Supported",
331 "setJavaUtilDate",
"KeyValueHandlerImpl"));
334 public void setJavaSqlTime(
int fieldNumber, Time value) {
336 local.
message(
"ERR_Operation_Not_Supported",
337 "setJavaSqlTime",
"KeyValueHandlerImpl"));
340 public void setJavaSqlTimestamp(
int fieldNumber, Timestamp value) {
342 local.
message(
"ERR_Operation_Not_Supported",
343 "setJavaSqlTimestamp",
"KeyValueHandlerImpl"));
346 public void markModified(
int fieldNumber) {
347 throw new UnsupportedOperationException(
"Not supported yet.");
350 public void resetModified() {
351 throw new UnsupportedOperationException(
"Not supported yet.");
354 public String pkToString(DomainTypeHandler<?> domainTypeHandler) {
356 int[] keys = domainTypeHandler.getKeyFieldNumbers();
359 sb.append(separator);
360 sb.append(values[
i]);
364 return sb.toString();
367 public void found(Boolean found) {
369 local.
message(
"ERR_Operation_Not_Supported",
370 "found(Boolean)",
"KeyValueHandlerImpl"));
375 local.
message(
"ERR_Operation_Not_Supported",
376 "columnMetadata",
"KeyValueHandlerImpl"));
379 public Boolean found() {
381 local.
message(
"ERR_Operation_Not_Supported",
382 "found",
"KeyValueHandlerImpl"));
385 public Object
get(
int columnNumber) {
387 local.
message(
"ERR_Operation_Not_Supported",
388 "get(int)",
"KeyValueHandlerImpl"));
391 public void set(
int columnNumber, Object value) {
393 local.
message(
"ERR_Operation_Not_Supported",
394 "set(int, Object)",
"KeyValueHandlerImpl"));