001: /*-
002: * See the file LICENSE for redistribution information.
003: *
004: * Copyright (c) 2002,2008 Oracle. All rights reserved.
005: *
006: * $Id: Enhanced3.java,v 1.5.2.3 2008/01/07 15:14:35 cwl Exp $
007: */
008:
009: package com.sleepycat.persist.test;
010:
011: /*
012: import java.math.BigIngeter;
013: import java.math.BigDecimal;
014: */
015: import java.util.Date;
016:
017: import com.sleepycat.persist.impl.Enhanced;
018: import com.sleepycat.persist.impl.EnhancedAccessor;
019: import com.sleepycat.persist.impl.EntityInput;
020: import com.sleepycat.persist.impl.EntityOutput;
021: import com.sleepycat.persist.impl.Format;
022: import com.sleepycat.persist.model.KeyField;
023: import com.sleepycat.persist.model.Persistent;
024:
025: /**
026: * For running ASMifier -- a composite key class using all simple data types,
027: * does not follow from previous EnhancedN.java files
028: */
029: @Persistent
030: class Enhanced3 implements Enhanced {
031:
032: @KeyField(1)
033: boolean z;
034: @KeyField(2)
035: char c;
036: @KeyField(3)
037: byte b;
038: @KeyField(4)
039: short s;
040: @KeyField(5)
041: int i;
042: @KeyField(6)
043: long l;
044: @KeyField(7)
045: float f;
046: @KeyField(8)
047: double d;
048:
049: @KeyField(9)
050: Boolean zw;
051: @KeyField(10)
052: Character cw;
053: @KeyField(11)
054: Byte bw;
055: @KeyField(12)
056: Short sw;
057: @KeyField(13)
058: Integer iw;
059: @KeyField(14)
060: Long lw;
061: @KeyField(15)
062: Float fw;
063: @KeyField(16)
064: Double dw;
065:
066: @KeyField(17)
067: Date date;
068: @KeyField(18)
069: String str;
070: /*
071: @KeyField(19) BigIngeter bigint;
072: @KeyField(20) BigDecimal bigdec;
073: */
074:
075: static {
076: EnhancedAccessor.registerClass(null, new Enhanced3());
077: }
078:
079: public Object bdbNewInstance() {
080: return new Enhanced3();
081: }
082:
083: public Object bdbNewArray(int len) {
084: return new Enhanced3[len];
085: }
086:
087: public boolean bdbIsPriKeyFieldNullOrZero() {
088: return false;
089: }
090:
091: public void bdbWritePriKeyField(EntityOutput output, Format format) {
092: }
093:
094: public void bdbReadPriKeyField(EntityInput input, Format format) {
095: }
096:
097: public void bdbWriteSecKeyFields(EntityOutput output) {
098: }
099:
100: public void bdbReadSecKeyFields(EntityInput input, int startField,
101: int endField, int super Level) {
102: }
103:
104: public void bdbWriteNonKeyFields(EntityOutput output) {
105: output.writeBoolean(z);
106: output.writeChar(c);
107: output.writeByte(b);
108: output.writeShort(s);
109: output.writeInt(i);
110: output.writeLong(l);
111: output.writeSortedFloat(f);
112: output.writeSortedDouble(d);
113:
114: output.writeBoolean(zw.booleanValue());
115: output.writeChar(cw.charValue());
116: output.writeByte(bw.byteValue());
117: output.writeShort(sw.shortValue());
118: output.writeInt(iw.intValue());
119: output.writeLong(lw.longValue());
120: output.writeSortedFloat(fw.floatValue());
121: output.writeSortedDouble(dw.doubleValue());
122:
123: output.writeLong(date.getTime());
124: output.writeString(str);
125: }
126:
127: public void bdbReadNonKeyFields(EntityInput input, int startField,
128: int endField, int super Level) {
129: z = input.readBoolean();
130: c = input.readChar();
131: b = input.readByte();
132: s = input.readShort();
133: i = input.readInt();
134: l = input.readLong();
135: f = input.readSortedFloat();
136: d = input.readSortedDouble();
137:
138: zw = Boolean.valueOf(input.readBoolean());
139: cw = Character.valueOf(input.readChar());
140: bw = Byte.valueOf(input.readByte());
141: sw = Short.valueOf(input.readShort());
142: iw = Integer.valueOf(input.readInt());
143: lw = Long.valueOf(input.readLong());
144: fw = Float.valueOf(input.readSortedFloat());
145: dw = Double.valueOf(input.readSortedDouble());
146:
147: date = new Date(input.readLong());
148: str = input.readString();
149: }
150:
151: public boolean bdbNullifyKeyField(Object o, int field,
152: int super Level, boolean isSecField, Object keyElement) {
153: // Didn't bother with this one.
154: return false;
155: }
156:
157: public Object bdbGetField(Object o, int field, int super Level,
158: boolean isSecField) {
159: // Didn't bother with this one.
160: return null;
161: }
162:
163: public void bdbSetField(Object o, int field, int super Level,
164: boolean isSecField, Object value) {
165: // Didn't bother with this one.
166: }
167: }
|