Package db

Class ObjectStorageAdapterDB

  • All Implemented Interfaces:
    ObjectStorage

    public class ObjectStorageAdapterDB
    extends java.lang.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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean getBoolean()
      Gets the boolean value.
      byte getByte()
      Gets the byte value.
      byte[] getBytes()
      Gets the byte array.
      double getDouble()
      Gets the double value.
      double[] getDoubles()
      Gets the double array.
      float getFloat()
      Gets the float value.
      float[] getFloats()
      Gets the float array.
      int getInt()
      Gets the int value.
      int[] getInts()
      Gets the int array.
      long getLong()
      Gets the long value.
      long[] getLongs()
      Gets the long array.
      Schema getSchema​(int version)
      Get the Schema associated with the stored data.
      short getShort()
      Gets the short value.
      short[] getShorts()
      Gets the short array.
      java.lang.String getString()
      Gets the String value.
      java.lang.String[] getStrings()
      Gets the array of Strings
      void putBoolean​(boolean value)
      Store a boolean value.
      void putByte​(byte value)
      Store a byte value.
      void putBytes​(byte[] value)
      Store a byte array.
      void putDouble​(double value)
      Store a double value.
      void putDoubles​(double[] value)
      Store a double array value.
      void putFloat​(float value)
      Store a float value.
      void putFloats​(float[] value)
      Store a float array.
      void putInt​(int value)
      Store an integer value.
      void putInts​(int[] value)
      Store an integer array.
      void putLong​(long value)
      Store a long value.
      void putLongs​(long[] value)
      Store a long array.
      void putShort​(short value)
      Store a short value.
      void putShorts​(short[] value)
      Store a short array.
      void putString​(java.lang.String value)
      Store a String value.
      void putStrings​(java.lang.String[] value)
      Store a String[] value.
      void save​(Record rec)
      Save data into a Record.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ObjectStorageAdapterDB

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

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

      • 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​(java.lang.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.
      • getString

        public java.lang.String getString()
        Description copied from interface: ObjectStorage
        Gets the String value.
        Specified by:
        getString 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​(java.lang.String[] value)
        Description copied from interface: ObjectStorage
        Store a String[] value.
        Specified by:
        putStrings in interface ObjectStorage
      • getStrings

        public java.lang.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​(Record rec)
        Save data into a Record.
        Parameters:
        rec - database record.