com.sleepycat.persist.impl
Class SimpleFormat

java.lang.Object
  extended by com.sleepycat.persist.impl.Format
      extended by com.sleepycat.persist.impl.SimpleFormat
All Implemented Interfaces:
RawType, java.io.Serializable
Direct Known Subclasses:
SimpleFormat.FBigInt, SimpleFormat.FBool, SimpleFormat.FByte, SimpleFormat.FChar, SimpleFormat.FDate, SimpleFormat.FDouble, SimpleFormat.FFloat, SimpleFormat.FInt, SimpleFormat.FLong, SimpleFormat.FShort, SimpleFormat.FString

public abstract class SimpleFormat
extends Format

Format for simple types, including primitives. Additional methods are included to optimize the handling of primitives. Other classes such as PrimitiveArrayFormat and ReflectAccessor take advantage of these methods.

See Also:
Serialized Form

Nested Class Summary
static class SimpleFormat.FBigInt
           
static class SimpleFormat.FBool
           
static class SimpleFormat.FByte
           
static class SimpleFormat.FChar
           
static class SimpleFormat.FDate
           
static class SimpleFormat.FDouble
           
static class SimpleFormat.FFloat
           
static class SimpleFormat.FInt
           
static class SimpleFormat.FLong
           
static class SimpleFormat.FShort
           
static class SimpleFormat.FString
           
 
Method Summary
 boolean isPrimitive()
          Returns whether this type is a Java primitive: char, byte, short, int, long, float or double.
 boolean isSimple()
          Returns whether this is a simple type: primitive, primitive wrapper, BigInteger, String or Date.
 java.lang.Object readObject(java.lang.Object o, EntityInput input, boolean rawAccess)
          Called after newInstance() to read the rest of the data bytes and fill in the object contents.
 
Methods inherited from class com.sleepycat.persist.impl.Format
getClassName, getComponentType, getDimensions, getEnumConstants, getFields, getPreviousVersion, getSuperType, getVersion, initializeReader, isArray, isEnum, newInstance, readPriKey, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

isSimple

public boolean isSimple()
Description copied from interface: RawType
Returns whether this is a simple type: primitive, primitive wrapper, BigInteger, String or Date.

If true is returned, RawType.isPrimitive() can be called for more information, and a raw value of this type is represented as a simple type object (not as a RawObject).

If false is returned, this is a complex type, an array type (see RawType.isArray()), or an enum type, and a raw value of this type is represented as a RawObject.

Specified by:
isSimple in interface RawType
Overrides:
isSimple in class Format

isPrimitive

public boolean isPrimitive()
Description copied from interface: RawType
Returns whether this type is a Java primitive: char, byte, short, int, long, float or double.

If true is returned, this is also a simple type. In other words, primitive types are a subset of simple types.

If true is returned, a raw value of this type is represented as a non-null instance of the primitive type's wrapper class. For example, an int raw value is represented as an Integer.

Specified by:
isPrimitive in interface RawType
Overrides:
isPrimitive in class Format

readObject

public java.lang.Object readObject(java.lang.Object o,
                                   EntityInput input,
                                   boolean rawAccess)
Description copied from class: Format
Called after newInstance() to read the rest of the data bytes and fill in the object contents. If the object was read completely by newInstance(), this method does nothing. Is public only in order to implement the Reader interface. Note that this method should only be called directly in raw conversion mode or during conversion of an old format. Normally it should be called via the getReader method and the Reader interface.

Specified by:
readObject in class Format