1/*- 2 * See the file LICENSE for redistribution information. 3 * 4 * Copyright (c) 2002,2008 Oracle. All rights reserved. 5 * 6 * $Id: EntityInput.java,v 1.1 2008/02/07 17:12:27 mark Exp $ 7 */ 8 9package com.sleepycat.persist.impl; 10 11import 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 */ 21public interface EntityInput { 22 23 24 /** 25 * Returns the Catalog associated with this input. 26 */ 27 Catalog getCatalog(); 28 29 /** 30 * Return whether this input is in raw mode, i.e., whether it is returning 31 * raw instances. 32 */ 33 boolean isRawAccess(); 34 35 /** 36 * Changes raw mode and returns the original mode, which is normally 37 * restored later. For temporarily changing the mode during a conversion. 38 */ 39 boolean setRawAccess(boolean rawAccessParam); 40 41 /** 42 * Called via Accessor to read all fields with reference types, except for 43 * the primary key field and composite key fields (see readKeyObject 44 * below). 45 */ 46 Object readObject(); 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 57 /** 58 * Called via Accessor.readSecKeyFields for a primary key field with a 59 * reference type. This method must be called before reading any other 60 * fields. 61 */ 62 void registerPriKeyObject(Object o); 63 64 /** 65 * Called by ObjectArrayFormat and PrimitiveArrayFormat to read the array 66 * length. 67 */ 68 int readArrayLength(); 69 70 /** 71 * Called by EnumFormat to read and return index of the enum constant. 72 */ 73 int readEnumConstant(String[] names); 74 75 /** 76 * Called via PersistKeyCreator to skip fields prior to the secondary key 77 * field. Also called during class evolution so skip deleted fields. 78 */ 79 void skipField(Format declaredFormat); 80 81 /* The following methods are a subset of the methods in TupleInput. */ 82 83 String readString(); 84 char readChar(); 85 boolean readBoolean(); 86 byte readByte(); 87 short readShort(); 88 int readInt(); 89 long readLong(); 90 float readSortedFloat(); 91 double readSortedDouble(); 92 BigInteger readBigInteger(); 93} 94