KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > persist > impl > EntityOutput


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: EntityOutput.java,v 1.13 2006/11/14 23:30:49 mark Exp $
7  */

8
9 package com.sleepycat.persist.impl;
10
11 import java.math.BigInteger JavaDoc;
12
13 import com.sleepycat.bind.tuple.TupleOutput;
14
15 /**
16  * Used for writing object fields.
17  *
18  * <p>Unlike TupleOutput, Strings should be passed to {@link #writeObject} when
19  * using this class.</p>
20  *
21  * <p>Note that currently there is only one implementation of EntityOutput:
22  * RecordOutput. There is no RawObjectOutput implemention because we currently
23  * have no need to convert from persistent objects to RawObject instances.
24  * The EntityOutput interface is only for symmetry with EntityInput and in case
25  * we need RawObjectOutput in the future.</p>
26  *
27  * @author Mark Hayes
28  */

29 public interface EntityOutput {
30
31     static final int PRI_KEY_VISITED_OFFSET = Integer.MAX_VALUE - 1;
32
33     /**
34      * Called via Accessor to write all fields with reference types, except for
35      * the primary key field and composite key fields (see writeKeyObject
36      * below).
37      */

38     void writeObject(Object JavaDoc o, Format fieldFormat);
39
40     /**
41      * Called for a primary key field or composite key field with a reference
42      * type.
43      */

44     void writeKeyObject(Object JavaDoc o, Format fieldFormat);
45
46     /**
47      * Called via Accessor.writeSecKeyFields for a primary key field with a
48      * reference type. This method must be called before writing any other
49      * fields.
50      */

51     void registerPriKeyObject(Object JavaDoc o);
52
53     /**
54      * Called by ObjectArrayFormat and PrimitiveArrayFormat to write the array
55      * length.
56      */

57     void writeArrayLength(int length);
58
59     /**
60      * Called by EnumFormat to write the given index of the enum constant.
61      */

62     void writeEnumConstant(String JavaDoc[] names, int index);
63
64     /* The following methods are a subset of the methods in TupleOutput. */
65
66     TupleOutput writeString(String JavaDoc val);
67     TupleOutput writeChar(int val);
68     TupleOutput writeBoolean(boolean val);
69     TupleOutput writeByte(int val);
70     TupleOutput writeShort(int val);
71     TupleOutput writeInt(int val);
72     TupleOutput writeLong(long val);
73     TupleOutput writeSortedFloat(float val);
74     TupleOutput writeSortedDouble(double val);
75     TupleOutput writeBigInteger(BigInteger JavaDoc val);
76 }
77
Popular Tags