KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > persist > test > Enhanced3


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: Enhanced3.java,v 1.5 2006/10/30 21:14:55 bostic Exp $
7  */

8
9 package com.sleepycat.persist.test;
10
11 /*
12 import java.math.BigIngeter;
13 import java.math.BigDecimal;
14 */

15 import java.util.Date JavaDoc;
16
17 import com.sleepycat.persist.impl.Enhanced;
18 import com.sleepycat.persist.impl.EnhancedAccessor;
19 import com.sleepycat.persist.impl.EntityInput;
20 import com.sleepycat.persist.impl.EntityOutput;
21 import com.sleepycat.persist.impl.Format;
22 import com.sleepycat.persist.model.KeyField;
23 import com.sleepycat.persist.model.Persistent;
24
25 /**
26  * For running ASMifier -- a composite key class using all simple data types,
27  * does not follow from previous EnhancedN.java files
28  */

29 @Persistent
30 class Enhanced3 implements Enhanced {
31
32     @KeyField(1) boolean z;
33     @KeyField(2) char c;
34     @KeyField(3) byte b;
35     @KeyField(4) short s;
36     @KeyField(5) int i;
37     @KeyField(6) long l;
38     @KeyField(7) float f;
39     @KeyField(8) double d;
40
41     @KeyField(9) Boolean JavaDoc zw;
42     @KeyField(10) Character JavaDoc cw;
43     @KeyField(11) Byte JavaDoc bw;
44     @KeyField(12) Short JavaDoc sw;
45     @KeyField(13) Integer JavaDoc iw;
46     @KeyField(14) Long JavaDoc lw;
47     @KeyField(15) Float JavaDoc fw;
48     @KeyField(16) Double JavaDoc dw;
49
50     @KeyField(17) Date JavaDoc date;
51     @KeyField(18) String JavaDoc str;
52     /*
53     @KeyField(19) BigIngeter bigint;
54     @KeyField(20) BigDecimal bigdec;
55     */

56
57     static {
58         EnhancedAccessor.registerClass(null, new Enhanced3());
59     }
60
61     public Object JavaDoc bdbNewInstance() {
62         return new Enhanced3();
63     }
64     
65     public Object JavaDoc bdbNewArray(int len) {
66         return new Enhanced3[len];
67     }
68
69     public boolean bdbIsPriKeyFieldNullOrZero() {
70         return false;
71     }
72
73     public void bdbWritePriKeyField(EntityOutput output, Format format) {
74     }
75
76     public void bdbReadPriKeyField(EntityInput input, Format format) {
77     }
78
79     public void bdbWriteSecKeyFields(EntityOutput output) {
80     }
81
82     public void bdbReadSecKeyFields(EntityInput input,
83                                     int startField,
84                                     int endField,
85                                     int superLevel) {
86     }
87
88     public void bdbWriteNonKeyFields(EntityOutput output) {
89         output.writeBoolean(z);
90         output.writeChar(c);
91         output.writeByte(b);
92         output.writeShort(s);
93         output.writeInt(i);
94         output.writeLong(l);
95         output.writeSortedFloat(f);
96         output.writeSortedDouble(d);
97
98         output.writeBoolean(zw.booleanValue());
99         output.writeChar(cw.charValue());
100         output.writeByte(bw.byteValue());
101         output.writeShort(sw.shortValue());
102         output.writeInt(iw.intValue());
103         output.writeLong(lw.longValue());
104         output.writeSortedFloat(fw.floatValue());
105         output.writeSortedDouble(dw.doubleValue());
106
107         output.writeLong(date.getTime());
108         output.writeString(str);
109     }
110
111     public void bdbReadNonKeyFields(EntityInput input,
112                                     int startField,
113                                     int endField,
114                                     int superLevel) {
115         z = input.readBoolean();
116         c = input.readChar();
117         b = input.readByte();
118         s = input.readShort();
119         i = input.readInt();
120         l = input.readLong();
121         f = input.readSortedFloat();
122         d = input.readSortedDouble();
123
124         zw = Boolean.valueOf(input.readBoolean());
125         cw = Character.valueOf(input.readChar());
126         bw = Byte.valueOf(input.readByte());
127         sw = Short.valueOf(input.readShort());
128         iw = Integer.valueOf(input.readInt());
129         lw = Long.valueOf(input.readLong());
130         fw = Float.valueOf(input.readSortedFloat());
131         dw = Double.valueOf(input.readSortedDouble());
132
133         date = new Date JavaDoc(input.readLong());
134         str = input.readString();
135     }
136
137     public boolean bdbNullifyKeyField(Object JavaDoc o,
138                                       int field,
139                                       int superLevel,
140                                       boolean isSecField,
141                                       Object JavaDoc keyElement) {
142         // Didn't bother with this one.
143
return false;
144     }
145
146     public Object JavaDoc bdbGetField(Object JavaDoc o,
147                               int field,
148                               int superLevel,
149                               boolean isSecField) {
150         // Didn't bother with this one.
151
return null;
152     }
153
154     public void bdbSetField(Object JavaDoc o,
155                             int field,
156                             int superLevel,
157                             boolean isSecField,
158                             Object JavaDoc value) {
159         // Didn't bother with this one.
160
}
161 }
162
Popular Tags