com.sleepycat.persist.impl
Class WidenerInput

java.lang.Object
  extended by com.sleepycat.persist.impl.AbstractInput
      extended by com.sleepycat.persist.impl.WidenerInput
All Implemented Interfaces:
EntityInput

 class WidenerInput
extends AbstractInput

Widens a value returned by another input when any readXxx method is called. Used to cause an Accessor to read a widened value. For non-key fields we support all Java primitive widening: - byte to short, int, long, float, double, BigInteger and BigDecimal - short to int, long, float, double, BigInteger and BigDecimal - char to int, long, float, double, BigInteger and BigDecimal - int to long, float, double, BigInteger and BigDecimal - long to float, double, BigInteger and BigDecimal - float to double For non-key fields we also support: - Java reference widening - primitive to primitive wrapper - Java primitive widening to corresponding primitive wrappers - Java widening of primitive wrapper to primitive wrapper For secondary keys fields we ONLY support: - primitive to primitive wrapper But for primary keys and composite key fields we ONLY support: - primitive to primitive wrapper - primitive wrapper to primitive These conversions don't require any converter, since the stored format is not changed. A WidenerInput is not used for these changes.

Author:
Mark Hayes

Field Summary
 
Fields inherited from class com.sleepycat.persist.impl.AbstractInput
catalog, rawAccess
 
Constructor Summary
WidenerInput(EntityInput input, int fromFormatId, int toFormatId)
           
 
Method Summary
(package private) static boolean isWideningSupported(Format fromFormat, Format toFormat, boolean isSecKeyField)
          Returns whether widening is supported by this class.
 int readArrayLength()
          Called by ObjectArrayFormat and PrimitiveArrayFormat to read the array length.
 BigInteger readBigInteger()
           
 boolean readBoolean()
           
 byte readByte()
           
 char readChar()
           
 int readEnumConstant(String[] names)
          Called by EnumFormat to read and return index of the enum constant.
 int readInt()
           
 Object readKeyObject(Format fromFormat)
          Called for a primary key field or a composite key field with a reference type.
 long readLong()
           
 Object readObject()
          Called via Accessor to read all fields with reference types, except for the primary key field and composite key fields (see readKeyObject below).
 short readShort()
           
 BigDecimal readSortedBigDecimal()
           
 double readSortedDouble()
           
 float readSortedFloat()
           
 String readString()
           
 Object readStringObject()
          Called for a String field, that is not a primary key field or a composite key field with a reference type.
 void registerPriKeyObject(Object o)
          Called via Accessor.readSecKeyFields for a primary key field with a reference type.
 void registerPriStringKeyObject(Object o)
          Called via Accessor.readSecKeyFields for a primary String key field.
 void skipField(Format declaredFormat)
          Called via PersistKeyCreator to skip fields prior to the secondary key field.
 
Methods inherited from class com.sleepycat.persist.impl.AbstractInput
getCatalog, isRawAccess, setRawAccess
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WidenerInput

WidenerInput(EntityInput input,
             int fromFormatId,
             int toFormatId)
Method Detail

isWideningSupported

static boolean isWideningSupported(Format fromFormat,
                                   Format toFormat,
                                   boolean isSecKeyField)
Returns whether widening is supported by this class. If false is returned by this method, then widening is disallowed and a field converter or deleter is necessary.


registerPriKeyObject

public void registerPriKeyObject(Object o)
Description copied from interface: EntityInput
Called via Accessor.readSecKeyFields for a primary key field with a reference type. This method must be called before reading any other fields.


registerPriStringKeyObject

public void registerPriStringKeyObject(Object o)
Description copied from interface: EntityInput
Called via Accessor.readSecKeyFields for a primary String key field. This method must be called before reading any other fields.


readArrayLength

public int readArrayLength()
Description copied from interface: EntityInput
Called by ObjectArrayFormat and PrimitiveArrayFormat to read the array length.


readEnumConstant

public int readEnumConstant(String[] names)
Description copied from interface: EntityInput
Called by EnumFormat to read and return index of the enum constant.


skipField

public void skipField(Format declaredFormat)
Description copied from interface: EntityInput
Called via PersistKeyCreator to skip fields prior to the secondary key field. Also called during class evolution so skip deleted fields.


readString

public String readString()

readKeyObject

public Object readKeyObject(Format fromFormat)
                     throws RefreshException
Description copied from interface: EntityInput
Called for a primary key field or a composite key field with a reference type.

For such key fields, no formatId is present nor can the object already be present in the visited object set.

Throws:
RefreshException

readObject

public Object readObject()
                  throws RefreshException
Description copied from interface: EntityInput
Called via Accessor to read all fields with reference types, except for the primary key field and composite key fields (see readKeyObject below).

Throws:
RefreshException

readChar

public char readChar()

readBoolean

public boolean readBoolean()

readByte

public byte readByte()

readShort

public short readShort()
                throws RefreshException
Throws:
RefreshException

readInt

public int readInt()
            throws RefreshException
Throws:
RefreshException

readLong

public long readLong()
              throws RefreshException
Throws:
RefreshException

readSortedFloat

public float readSortedFloat()
                      throws RefreshException
Throws:
RefreshException

readSortedDouble

public double readSortedDouble()
                        throws RefreshException
Throws:
RefreshException

readBigInteger

public BigInteger readBigInteger()
                          throws RefreshException
Throws:
RefreshException

readSortedBigDecimal

public BigDecimal readSortedBigDecimal()
                                throws RefreshException
Throws:
RefreshException

readStringObject

public Object readStringObject()
Description copied from interface: EntityInput
Called for a String field, that is not a primary key field or a composite key field with a reference type.

For the new String format, no formatId is present nor can the object already be present in the visited object set. For the old String format, this method simply calls readObject for compatibility.



Copyright (c) 2004-2012 Oracle. All rights reserved.