Package db
Class ObjectStorageAdapterDB
- java.lang.Object
-
- db.ObjectStorageAdapterDB
-
- All Implemented Interfaces:
ObjectStorage
public class ObjectStorageAdapterDB extends java.lang.Object implements ObjectStorage
ObjectStorageAdapterDBprovides 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 Summary
Constructors Constructor Description ObjectStorageAdapterDB()Construct an empty writable storage adapter.ObjectStorageAdapterDB(Record rec)Construct a read-only storage adapter from an existing record.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetBoolean()Gets the boolean value.bytegetByte()Gets the byte value.byte[]getBytes()Gets the byte array.doublegetDouble()Gets the double value.double[]getDoubles()Gets the double array.floatgetFloat()Gets the float value.float[]getFloats()Gets the float array.intgetInt()Gets the int value.int[]getInts()Gets the int array.longgetLong()Gets the long value.long[]getLongs()Gets the long array.SchemagetSchema(int version)Get the Schema associated with the stored data.shortgetShort()Gets the short value.short[]getShorts()Gets the short array.java.lang.StringgetString()Gets the String value.java.lang.String[]getStrings()Gets the array of StringsvoidputBoolean(boolean value)Store a boolean value.voidputByte(byte value)Store a byte value.voidputBytes(byte[] value)Store a byte array.voidputDouble(double value)Store a double value.voidputDoubles(double[] value)Store a double array value.voidputFloat(float value)Store a float value.voidputFloats(float[] value)Store a float array.voidputInt(int value)Store an integer value.voidputInts(int[] value)Store an integer array.voidputLong(long value)Store a long value.voidputLongs(long[] value)Store a long array.voidputShort(short value)Store a short value.voidputShorts(short[] value)Store a short array.voidputString(java.lang.String value)Store a String value.voidputStrings(java.lang.String[] value)Store a String[] value.voidsave(Record rec)Save data into a Record.
-
-
-
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:ObjectStorageStore an integer value.- Specified by:
putIntin interfaceObjectStorage- Parameters:
value- The value in the name,value pair.
-
putByte
public void putByte(byte value)
Description copied from interface:ObjectStorageStore a byte value.- Specified by:
putBytein interfaceObjectStorage- Parameters:
value- The value in the name,value pair.
-
putShort
public void putShort(short value)
Description copied from interface:ObjectStorageStore a short value.- Specified by:
putShortin interfaceObjectStorage- Parameters:
value- The value in the name,value pair.
-
putLong
public void putLong(long value)
Description copied from interface:ObjectStorageStore a long value.- Specified by:
putLongin interfaceObjectStorage- Parameters:
value- The value in the name,value pair.
-
putString
public void putString(java.lang.String value)
Description copied from interface:ObjectStorageStore a String value.- Specified by:
putStringin interfaceObjectStorage- Parameters:
value- The value in the name,value pair.
-
putBoolean
public void putBoolean(boolean value)
Description copied from interface:ObjectStorageStore a boolean value.- Specified by:
putBooleanin interfaceObjectStorage- Parameters:
value- The value in the name,value pair.
-
putFloat
public void putFloat(float value)
Description copied from interface:ObjectStorageStore a float value.- Specified by:
putFloatin interfaceObjectStorage- Parameters:
value- The value in the name,value pair.
-
putDouble
public void putDouble(double value)
Description copied from interface:ObjectStorageStore a double value.- Specified by:
putDoublein interfaceObjectStorage- Parameters:
value- The value in the name,value pair.
-
getInt
public int getInt()
Description copied from interface:ObjectStorageGets the int value.- Specified by:
getIntin interfaceObjectStorage
-
getByte
public byte getByte()
Description copied from interface:ObjectStorageGets the byte value.- Specified by:
getBytein interfaceObjectStorage
-
getShort
public short getShort()
Description copied from interface:ObjectStorageGets the short value.- Specified by:
getShortin interfaceObjectStorage
-
getLong
public long getLong()
Description copied from interface:ObjectStorageGets the long value.- Specified by:
getLongin interfaceObjectStorage
-
getBoolean
public boolean getBoolean()
Description copied from interface:ObjectStorageGets the boolean value.- Specified by:
getBooleanin interfaceObjectStorage
-
getString
public java.lang.String getString()
Description copied from interface:ObjectStorageGets the String value.- Specified by:
getStringin interfaceObjectStorage
-
getFloat
public float getFloat()
Description copied from interface:ObjectStorageGets the float value.- Specified by:
getFloatin interfaceObjectStorage
-
getDouble
public double getDouble()
Description copied from interface:ObjectStorageGets the double value.- Specified by:
getDoublein interfaceObjectStorage
-
putInts
public void putInts(int[] value)
Description copied from interface:ObjectStorageStore an integer array.- Specified by:
putIntsin interfaceObjectStorage
-
putBytes
public void putBytes(byte[] value)
Description copied from interface:ObjectStorageStore a byte array.- Specified by:
putBytesin interfaceObjectStorage
-
putShorts
public void putShorts(short[] value)
Description copied from interface:ObjectStorageStore a short array.- Specified by:
putShortsin interfaceObjectStorage
-
putLongs
public void putLongs(long[] value)
Description copied from interface:ObjectStorageStore a long array.- Specified by:
putLongsin interfaceObjectStorage
-
putFloats
public void putFloats(float[] value)
Description copied from interface:ObjectStorageStore a float array.- Specified by:
putFloatsin interfaceObjectStorage
-
putDoubles
public void putDoubles(double[] value)
Description copied from interface:ObjectStorageStore a double array value.- Specified by:
putDoublesin interfaceObjectStorage
-
putStrings
public void putStrings(java.lang.String[] value)
Description copied from interface:ObjectStorageStore a String[] value.- Specified by:
putStringsin interfaceObjectStorage
-
getInts
public int[] getInts()
Description copied from interface:ObjectStorageGets the int array.- Specified by:
getIntsin interfaceObjectStorage
-
getBytes
public byte[] getBytes()
Description copied from interface:ObjectStorageGets the byte array.- Specified by:
getBytesin interfaceObjectStorage
-
getShorts
public short[] getShorts()
Description copied from interface:ObjectStorageGets the short array.- Specified by:
getShortsin interfaceObjectStorage
-
getLongs
public long[] getLongs()
Description copied from interface:ObjectStorageGets the long array.- Specified by:
getLongsin interfaceObjectStorage
-
getFloats
public float[] getFloats()
Description copied from interface:ObjectStorageGets the float array.- Specified by:
getFloatsin interfaceObjectStorage
-
getDoubles
public double[] getDoubles()
Description copied from interface:ObjectStorageGets the double array.- Specified by:
getDoublesin interfaceObjectStorage
-
getStrings
public java.lang.String[] getStrings()
Description copied from interface:ObjectStorageGets the array of Strings- Specified by:
getStringsin interfaceObjectStorage
-
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.
-
-