Debian Codegraph @

lang/java/src/com/sleepycat/persist/impl/EntityInput.java

raw
1 /*-
2 * See the file LICENSE for redistribution information.
3 *
4 * Copyright (c) 2002, 2013 Oracle and/or its affiliates. All rights reserved.
5 *
6 */
7
8 package com.sleepycat.persist.impl;
9
10 import java.math.BigDecimal;
11 import java.math.BigInteger;
12
13 /**
14 * Used for reading object fields.
15 *
16 * <p>Unlike TupleInput, Strings are returned by {@link #readObject} when using
17 * this class.</p>
18 *
19 * @author Mark Hayes
20 */
21 public interface EntityInput {
22
23 /**
24 * Returns the Catalog associated with this input.
25 */
26 Catalog getCatalog();
27
28 /**
29 * Return whether this input is in raw mode, i.e., whether it is returning
30 * raw instances.
31 */
32 boolean isRawAccess();
33
34 /**
35 * Changes raw mode and returns the original mode, which is normally
36 * restored later. For temporarily changing the mode during a conversion.
37 */
38 boolean setRawAccess(boolean rawAccessParam);
39
40 /**
41 * Called via Accessor to read all fields with reference types, except for
42 * the primary key field and composite key fields (see readKeyObject
43 * below).
44 */
45 Object readObject()
46 throws RefreshException;
47
48 /**
49 * Called for a primary key field or a composite key field with a reference
50 * type.
51 *
52 * <p>For such key fields, no formatId is present nor can the object
53 * already be present in the visited object set.</p>
54 */
55 Object readKeyObject(Format format)
56 throws RefreshException;
57
58 /**
59 * Called for a String field, that is not a primary key field or a
60 * composite key field with a reference type.
61 *
62 * <p>For the new String format, no formatId is present nor can the object
63 * already be present in the visited object set. For the old String
64 * format, this method simply calls readObject for compatibility.</p>
65 */
66 Object readStringObject()
67 throws RefreshException;
68
69 /**
70 * Called via Accessor.readSecKeyFields for a primary key field with a
71 * reference type. This method must be called before reading any other
72 * fields.
73 */
74 void registerPriKeyObject(Object o);
75
76 /**
77 * Called via Accessor.readSecKeyFields for a primary String key field.
78 * This method must be called before reading any other fields.
79 */
80 void registerPriStringKeyObject(Object o);
81
82 /**
83 * Called by ObjectArrayFormat and PrimitiveArrayFormat to read the array
84 * length.
85 */
86 int readArrayLength();
87
88 /**
89 * Called by EnumFormat to read and return index of the enum constant.
90 */
91 int readEnumConstant(String[] names);
92
93 /**
94 * Called via PersistKeyCreator to skip fields prior to the secondary key
95 * field. Also called during class evolution so skip deleted fields.
96 */
97 void skipField(Format declaredFormat)
98 throws RefreshException;
99
100 /* The following methods are a subset of the methods in TupleInput. */
101
102 String readString()
103 throws RefreshException;
104 char readChar()
105 throws RefreshException;
106 boolean readBoolean()
107 throws RefreshException;
108 byte readByte()
109 throws RefreshException;
110 short readShort()
111 throws RefreshException;
112 int readInt()
113 throws RefreshException;
114 long readLong()
115 throws RefreshException;
116 float readSortedFloat()
117 throws RefreshException;
118 double readSortedDouble()
119 throws RefreshException;
120 BigInteger readBigInteger()
121 throws RefreshException;
122 BigDecimal readSortedBigDecimal()
123 throws RefreshException;
124 }