001: /*-
002: * See the file LICENSE for redistribution information.
003: *
004: * Copyright (c) 2002,2008 Oracle. All rights reserved.
005: *
006: * $Id: EntityInput.java,v 1.16.2.3 2008/01/07 15:14:19 cwl Exp $
007: */
008:
009: package com.sleepycat.persist.impl;
010:
011: import java.math.BigInteger;
012:
013: /**
014: * Used for reading object fields.
015: *
016: * <p>Unlike TupleInput, Strings are returned by {@link #readObject} when using
017: * this class.</p>
018: *
019: * @author Mark Hayes
020: */
021: public interface EntityInput {
022:
023: /**
024: * Returns the Catalog associated with this input.
025: */
026: Catalog getCatalog();
027:
028: /**
029: * Return whether this input is in raw mode, i.e., whether it is returning
030: * raw instances.
031: */
032: boolean isRawAccess();
033:
034: /**
035: * Changes raw mode and returns the original mode, which is normally
036: * restored later. For temporarily changing the mode during a conversion.
037: */
038: boolean setRawAccess(boolean rawAccessParam);
039:
040: /**
041: * Called via Accessor to read all fields with reference types, except for
042: * the primary key field and composite key fields (see readKeyObject
043: * below).
044: */
045: Object readObject();
046:
047: /**
048: * Called for a primary key field or a composite key field with a reference
049: * type.
050: *
051: * <p>For such key fields, no formatId is present nor can the object
052: * already be present in the visited object set.</p>
053: */
054: Object readKeyObject(Format format);
055:
056: /**
057: * Called via Accessor.readSecKeyFields for a primary key field with a
058: * reference type. This method must be called before reading any other
059: * fields.
060: */
061: void registerPriKeyObject(Object o);
062:
063: /**
064: * Called by ObjectArrayFormat and PrimitiveArrayFormat to read the array
065: * length.
066: */
067: int readArrayLength();
068:
069: /**
070: * Called by EnumFormat to read and return index of the enum constant.
071: */
072: int readEnumConstant(String[] names);
073:
074: /**
075: * Called via PersistKeyCreator to skip fields prior to the secondary key
076: * field. Also called during class evolution so skip deleted fields.
077: */
078: void skipField(Format declaredFormat);
079:
080: /* The following methods are a subset of the methods in TupleInput. */
081:
082: String readString();
083:
084: char readChar();
085:
086: boolean readBoolean();
087:
088: byte readByte();
089:
090: short readShort();
091:
092: int readInt();
093:
094: long readLong();
095:
096: float readSortedFloat();
097:
098: double readSortedDouble();
099:
100: BigInteger readBigInteger();
101: }
|