Package db

Class ObjectStorageAdapterDB

java.lang.Object
db.ObjectStorageAdapterDB
All Implemented Interfaces:
ObjectStorage

public class ObjectStorageAdapterDB extends Object implements ObjectStorage
ObjectStorageAdapterDB provides an ObjectStorage implementation for use by Saveable objects. This allows Saveable objects to save or restore their state using a fixed set of primitives and primitive arrays. This implementation provides various data access methods for storing/retrieving data. In addition, support is provided for utilizing a Record object for data storage using a suitable schema.
  • Constructor Details

    • ObjectStorageAdapterDB

      public ObjectStorageAdapterDB()
      Construct an empty writable storage adapter.
    • ObjectStorageAdapterDB

      public ObjectStorageAdapterDB(DBRecord rec)
      Construct a read-only storage adapter from an existing record.
      Parameters:
      rec - data record
  • Method Details

    • putInt

      public void putInt(int value)
      Description copied from interface: ObjectStorage
      Store an integer value.
      Specified by:
      putInt in interface ObjectStorage
      Parameters:
      value - The value in the name,value pair.
    • putByte

      public void putByte(byte value)
      Description copied from interface: ObjectStorage
      Store a byte value.
      Specified by:
      putByte in interface ObjectStorage
      Parameters:
      value - The value in the name,value pair.
    • putShort

      public void putShort(short value)
      Description copied from interface: ObjectStorage
      Store a short value.
      Specified by:
      putShort in interface ObjectStorage
      Parameters:
      value - The value in the name,value pair.
    • putLong

      public void putLong(long value)
      Description copied from interface: ObjectStorage
      Store a long value.
      Specified by:
      putLong in interface ObjectStorage
      Parameters:
      value - The value in the name,value pair.
    • putString

      public void putString(String value)
      Description copied from interface: ObjectStorage
      Store a String value.
      Specified by:
      putString in interface ObjectStorage
      Parameters:
      value - The value in the name,value pair.
    • putBoolean

      public void putBoolean(boolean value)
      Description copied from interface: ObjectStorage
      Store a boolean value.
      Specified by:
      putBoolean in interface ObjectStorage
      Parameters:
      value - The value in the name,value pair.
    • putFloat

      public void putFloat(float value)
      Description copied from interface: ObjectStorage
      Store a float value.
      Specified by:
      putFloat in interface ObjectStorage
      Parameters:
      value - The value in the name,value pair.
    • putDouble

      public void putDouble(double value)
      Description copied from interface: ObjectStorage
      Store a double value.
      Specified by:
      putDouble in interface ObjectStorage
      Parameters:
      value - The value in the name,value pair.
    • getInt

      public int getInt()
      Description copied from interface: ObjectStorage
      Gets the int value.
      Specified by:
      getInt in interface ObjectStorage
    • getByte

      public byte getByte()
      Description copied from interface: ObjectStorage
      Gets the byte value.
      Specified by:
      getByte in interface ObjectStorage
    • getShort

      public short getShort()
      Description copied from interface: ObjectStorage
      Gets the short value.
      Specified by:
      getShort in interface ObjectStorage
    • getLong

      public long getLong()
      Description copied from interface: ObjectStorage
      Gets the long value.
      Specified by:
      getLong in interface ObjectStorage
    • getBoolean

      public boolean getBoolean()
      Description copied from interface: ObjectStorage
      Gets the boolean value.
      Specified by:
      getBoolean in interface ObjectStorage
    • getString

      public String getString()
      Description copied from interface: ObjectStorage
      Gets the String value.
      Specified by:
      getString in interface ObjectStorage
    • getFloat

      public float getFloat()
      Description copied from interface: ObjectStorage
      Gets the float value.
      Specified by:
      getFloat in interface ObjectStorage
    • getDouble

      public double getDouble()
      Description copied from interface: ObjectStorage
      Gets the double value.
      Specified by:
      getDouble in interface ObjectStorage
    • putInts

      public void putInts(int[] value)
      Description copied from interface: ObjectStorage
      Store an integer array.
      Specified by:
      putInts in interface ObjectStorage
    • putBytes

      public void putBytes(byte[] value)
      Description copied from interface: ObjectStorage
      Store a byte array.
      Specified by:
      putBytes in interface ObjectStorage
    • putShorts

      public void putShorts(short[] value)
      Description copied from interface: ObjectStorage
      Store a short array.
      Specified by:
      putShorts in interface ObjectStorage
    • putLongs

      public void putLongs(long[] value)
      Description copied from interface: ObjectStorage
      Store a long array.
      Specified by:
      putLongs in interface ObjectStorage
    • putFloats

      public void putFloats(float[] value)
      Description copied from interface: ObjectStorage
      Store a float array.
      Specified by:
      putFloats in interface ObjectStorage
    • putDoubles

      public void putDoubles(double[] value)
      Description copied from interface: ObjectStorage
      Store a double array value.
      Specified by:
      putDoubles in interface ObjectStorage
    • putStrings

      public void putStrings(String[] value)
      Description copied from interface: ObjectStorage
      Store a String[] value.
      Specified by:
      putStrings in interface ObjectStorage
    • getInts

      public int[] getInts()
      Description copied from interface: ObjectStorage
      Gets the int array.
      Specified by:
      getInts in interface ObjectStorage
    • getBytes

      public byte[] getBytes()
      Description copied from interface: ObjectStorage
      Gets the byte array.
      Specified by:
      getBytes in interface ObjectStorage
    • getShorts

      public short[] getShorts()
      Description copied from interface: ObjectStorage
      Gets the short array.
      Specified by:
      getShorts in interface ObjectStorage
    • getLongs

      public long[] getLongs()
      Description copied from interface: ObjectStorage
      Gets the long array.
      Specified by:
      getLongs in interface ObjectStorage
    • getFloats

      public float[] getFloats()
      Description copied from interface: ObjectStorage
      Gets the float array.
      Specified by:
      getFloats in interface ObjectStorage
    • getDoubles

      public double[] getDoubles()
      Description copied from interface: ObjectStorage
      Gets the double array.
      Specified by:
      getDoubles in interface ObjectStorage
    • getStrings

      public String[] getStrings()
      Description copied from interface: ObjectStorage
      Gets the array of Strings
      Specified by:
      getStrings in interface ObjectStorage
    • getSchema

      public Schema getSchema(int version)
      Get the Schema associated with the stored data.
      Parameters:
      version - version to be assigned to schema instance
      Returns:
      Schema
    • save

      public void save(DBRecord rec)
      Save data into a Record.
      Parameters:
      rec - database record.