Package db
Class ObjectStorageAdapterDB
java.lang.Object
db.ObjectStorageAdapterDB
- All Implemented Interfaces:
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 Summary
ConstructorDescriptionConstruct an empty writable storage adapter.Construct a read-only storage adapter from an existing record. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets the boolean value.byte
getByte()
Gets the byte value.byte[]
getBytes()
Gets the byte array.double
Gets the double value.double[]
Gets the double array.float
getFloat()
Gets the float value.float[]
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.getSchema
(int version) Get the Schema associated with the stored data.short
getShort()
Gets the short value.short[]
Gets the short array.Gets the String value.String[]
Gets the array of Stringsvoid
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
Store a String value.void
putStrings
(String[] value) Store a String[] value.void
Save data into a Record.
-
Constructor Details
-
ObjectStorageAdapterDB
public ObjectStorageAdapterDB()Construct an empty writable storage adapter. -
ObjectStorageAdapterDB
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 interfaceObjectStorage
- 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 interfaceObjectStorage
- 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 interfaceObjectStorage
- 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 interfaceObjectStorage
- Parameters:
value
- The value in the name,value pair.
-
putString
Description copied from interface:ObjectStorage
Store a String value.- Specified by:
putString
in interfaceObjectStorage
- 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 interfaceObjectStorage
- 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 interfaceObjectStorage
- 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 interfaceObjectStorage
- 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 interfaceObjectStorage
-
getByte
public byte getByte()Description copied from interface:ObjectStorage
Gets the byte value.- Specified by:
getByte
in interfaceObjectStorage
-
getShort
public short getShort()Description copied from interface:ObjectStorage
Gets the short value.- Specified by:
getShort
in interfaceObjectStorage
-
getLong
public long getLong()Description copied from interface:ObjectStorage
Gets the long value.- Specified by:
getLong
in interfaceObjectStorage
-
getBoolean
public boolean getBoolean()Description copied from interface:ObjectStorage
Gets the boolean value.- Specified by:
getBoolean
in interfaceObjectStorage
-
getString
Description copied from interface:ObjectStorage
Gets the String value.- Specified by:
getString
in interfaceObjectStorage
-
getFloat
public float getFloat()Description copied from interface:ObjectStorage
Gets the float value.- Specified by:
getFloat
in interfaceObjectStorage
-
getDouble
public double getDouble()Description copied from interface:ObjectStorage
Gets the double value.- Specified by:
getDouble
in interfaceObjectStorage
-
putInts
public void putInts(int[] value) Description copied from interface:ObjectStorage
Store an integer array.- Specified by:
putInts
in interfaceObjectStorage
-
putBytes
public void putBytes(byte[] value) Description copied from interface:ObjectStorage
Store a byte array.- Specified by:
putBytes
in interfaceObjectStorage
-
putShorts
public void putShorts(short[] value) Description copied from interface:ObjectStorage
Store a short array.- Specified by:
putShorts
in interfaceObjectStorage
-
putLongs
public void putLongs(long[] value) Description copied from interface:ObjectStorage
Store a long array.- Specified by:
putLongs
in interfaceObjectStorage
-
putFloats
public void putFloats(float[] value) Description copied from interface:ObjectStorage
Store a float array.- Specified by:
putFloats
in interfaceObjectStorage
-
putDoubles
public void putDoubles(double[] value) Description copied from interface:ObjectStorage
Store a double array value.- Specified by:
putDoubles
in interfaceObjectStorage
-
putStrings
Description copied from interface:ObjectStorage
Store a String[] value.- Specified by:
putStrings
in interfaceObjectStorage
-
getInts
public int[] getInts()Description copied from interface:ObjectStorage
Gets the int array.- Specified by:
getInts
in interfaceObjectStorage
-
getBytes
public byte[] getBytes()Description copied from interface:ObjectStorage
Gets the byte array.- Specified by:
getBytes
in interfaceObjectStorage
-
getShorts
public short[] getShorts()Description copied from interface:ObjectStorage
Gets the short array.- Specified by:
getShorts
in interfaceObjectStorage
-
getLongs
public long[] getLongs()Description copied from interface:ObjectStorage
Gets the long array.- Specified by:
getLongs
in interfaceObjectStorage
-
getFloats
public float[] getFloats()Description copied from interface:ObjectStorage
Gets the float array.- Specified by:
getFloats
in interfaceObjectStorage
-
getDoubles
public double[] getDoubles()Description copied from interface:ObjectStorage
Gets the double array.- Specified by:
getDoubles
in interfaceObjectStorage
-
getStrings
Description copied from interface:ObjectStorage
Gets the array of Strings- Specified by:
getStrings
in interfaceObjectStorage
-
getSchema
Get the Schema associated with the stored data.- Parameters:
version
- version to be assigned to schema instance- Returns:
- Schema
-
save
Save data into a Record.- Parameters:
rec
- database record.
-