1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.util;
17
18 import java.math.BigInteger;
19
20 import org.apache.ojb.broker.accesslayer.conversions.FieldConversion;
21
22 public class OjbKualiIntegerFieldConversion implements FieldConversion {
23
24
25
26
27 public Object javaToSql(Object source) {
28 Object converted = source;
29
30 if (source instanceof KualiInteger) {
31 converted = new Long(((KualiInteger) source).longValue());
32 }
33
34 return converted;
35 }
36
37
38
39
40 public Object sqlToJava(Object source) {
41 Object converted = source;
42
43 if (source instanceof Long) {
44 converted = new KualiInteger(((Long) source).longValue());
45 }
46 else if (source instanceof BigInteger) {
47 converted = new KualiInteger((BigInteger) source);
48 }
49
50 return converted;
51 }
52 }