addKeyPart.
The update
and merge
method are integrated very aggressive and overwrite all values an
instance of this class. You will have to overwrite them.
Remember: If you want to be as effective as possible, you have to implement your own storable extending the
AbstractKVStorable
.
- Author:
- Martin Nettling
- See Also:
- Serialized Form
Method Summary |
GeneralStorable |
clone()
|
GeneralStorable |
fromByteBuffer(java.nio.ByteBuffer bb)
Generates a new Object from the given ByteBuffer . |
java.nio.ByteBuffer |
getKey(int index)
Returns the key belonging to the given field as read-only ByteBuffer |
java.nio.ByteBuffer |
getKey(java.lang.String field)
Returns the key belonging to the given field as read-only ByteBuffer |
byte |
getKeyAsByte(int index)
Returns the key belonging to the given field as byte |
byte |
getKeyAsByte(java.lang.String field)
Returns the key belonging to the given field as byte |
char |
getKeyAsChar(int index)
Returns the key belonging to the given field as char |
char |
getKeyAsChar(java.lang.String field)
Returns the key belonging to the given field as char |
double |
getKeyAsDouble(int index)
Returns the key belonging to the given field as long |
double |
getKeyAsDouble(java.lang.String field)
Returns the key belonging to the given field as long |
float |
getKeyAsFloat(int index)
Returns the key belonging to the given field as Int |
float |
getKeyAsFloat(java.lang.String field)
Returns the key belonging to the given field as int |
int |
getKeyAsInt(int index)
Returns the key belonging to the given field as Int |
int |
getKeyAsInt(java.lang.String field)
Returns the key belonging to the given field as int |
long |
getKeyAsLong(int index)
Returns the key belonging to the given field as long |
long |
getKeyAsLong(java.lang.String field)
Returns the key belonging to the given field as long |
java.nio.ByteBuffer |
getValue(int index)
Returns the value belonging to the given field as read-only ByteBuffer |
java.nio.ByteBuffer |
getValue(java.lang.String field)
Returns the value belonging to the given field as read-only ByteBuffer |
byte |
getValueAsByte(int index)
Returns the value belonging to the given field as byte |
byte |
getValueAsByte(java.lang.String field)
Returns the value belonging to the given field as byte |
char |
getValueAsChar(int index)
Returns the value belonging to the given field as char |
char |
getValueAsChar(java.lang.String field)
Returns the value belonging to the given field as char |
double |
getValueAsDouble(int index)
Returns the value belonging to the given field as long |
double |
getValueAsDouble(java.lang.String field)
Returns the value belonging to the given field as long |
float |
getValueAsFloat(int index)
Returns the value belonging to the given field as Int |
float |
getValueAsFloat(java.lang.String field)
Returns the value belonging to the given field as int |
int |
getValueAsInt(int index)
Returns the value belonging to the given field as Int |
int |
getValueAsInt(java.lang.String field)
Returns the value belonging to the given field as int |
long |
getValueAsLong(int index)
Returns the value belonging to the given field as long |
long |
getValueAsLong(java.lang.String field)
Returns the value belonging to the given field as long |
void |
initFromByteBuffer(java.nio.ByteBuffer bb)
Initializes the object from the given ByteBuffer |
|
merge(Data element)
Merges the given AbstractKVStorable with this one by your implementation. |
void |
setKey(int index,
byte key)
Sets the key belonging to the given field. |
void |
setKey(int index,
byte[] key)
Sets the key belonging to the given field. |
void |
setKey(int index,
char key)
Sets the key belonging to the given field. |
void |
setKey(int index,
double key)
Sets the key belonging to the given field. |
void |
setKey(int index,
float key)
Sets the key belonging to the given field. |
void |
setKey(int index,
int key)
Sets the key belonging to the given field. |
void |
setKey(int index,
long key)
Sets the key belonging to the given field. |
void |
setKey(java.lang.String field,
byte key)
Sets the key belonging to the given field. |
void |
setKey(java.lang.String field,
byte[] key)
Sets the key belonging to the given field. |
void |
setKey(java.lang.String field,
char key)
Sets the key belonging to the given field. |
void |
setKey(java.lang.String field,
double key)
Sets the key belonging to the given field. |
void |
setKey(java.lang.String field,
float key)
Sets the key belonging to the given field. |
void |
setKey(java.lang.String field,
int key)
Sets the key belonging to the given field. |
void |
setKey(java.lang.String field,
long key)
Sets the key belonging to the given field. |
void |
setValue(int index,
byte value)
Sets the value belonging to the given field. |
void |
setValue(int index,
byte[] value)
Sets the value belonging to the given field. |
void |
setValue(int index,
char value)
Sets the value belonging to the given field. |
void |
setValue(int index,
double value)
Sets the value belonging to the given field. |
void |
setValue(int index,
float value)
Sets the value belonging to the given field. |
void |
setValue(int index,
int value)
Sets the value belonging to the given field. |
void |
setValue(int index,
long value)
Sets the value belonging to the given field. |
void |
setValue(java.lang.String field,
byte value)
Sets the value belonging to the given field. |
void |
setValue(java.lang.String field,
byte[] value)
Sets the value belonging to the given field. |
void |
setValue(java.lang.String field,
char value)
Sets the value belonging to the given field. |
void |
setValue(java.lang.String field,
double value)
Sets the value belonging to the given field. |
void |
setValue(java.lang.String field,
float value)
Sets the value belonging to the given field. |
void |
setValue(java.lang.String field,
int value)
Sets the value belonging to the given field. |
void |
setValue(java.lang.String field,
long value)
Sets the value belonging to the given field. |
java.nio.ByteBuffer |
toByteBuffer()
Converts the object to a ByteBuffer |
java.lang.String |
toString()
|
void |
update(AbstractKVStorable element)
Updates the given AbstractKVStorable with values from this one. |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
GeneralStorable
public GeneralStorable(GeneralStructure s)
- Basic constructor. Should only be used, when the structure of the
- Parameters:
s
- the structure of this GeneralStorable
.
initFromByteBuffer
public void initFromByteBuffer(java.nio.ByteBuffer bb)
- Description copied from class:
AbstractKVStorable
- Initializes the object from the given
ByteBuffer
- Specified by:
initFromByteBuffer
in class AbstractKVStorable
fromByteBuffer
public GeneralStorable fromByteBuffer(java.nio.ByteBuffer bb)
- Description copied from class:
AbstractKVStorable
- Generates a new Object from the given
ByteBuffer
.
- Specified by:
fromByteBuffer
in class AbstractKVStorable
- Returns:
- a new instances of this Class
toByteBuffer
public java.nio.ByteBuffer toByteBuffer()
- Description copied from class:
AbstractKVStorable
- Converts the object to a
ByteBuffer
- Specified by:
toByteBuffer
in class AbstractKVStorable
- Returns:
- the object as
ByteBuffer
clone
public GeneralStorable clone()
- Specified by:
clone
in class AbstractKVStorable
merge
public <Data extends AbstractKVStorable> Data merge(Data element)
- Description copied from class:
AbstractKVStorable
- Merges the given
AbstractKVStorable
with this one by your implementation.
- Specified by:
merge
in class AbstractKVStorable
- Returns:
- a pointer to an
AbstractKVStorable
.
update
public void update(AbstractKVStorable element)
- Description copied from class:
AbstractKVStorable
- Updates the given
AbstractKVStorable
with values from this one.
- Specified by:
update
in class AbstractKVStorable
setValue
public void setValue(java.lang.String field,
byte[] value)
throws java.io.IOException
- Sets the value belonging to the given field.
- Parameters:
field
- the name of the fieldvalue
- the value to set
- Throws:
java.io.IOException
setValue
public void setValue(int index,
byte[] value)
throws java.io.IOException
- Sets the value belonging to the given field.
- Parameters:
index
- the index of the requested fieldvalue
- the value to set
- Throws:
java.io.IOException
setValue
public void setValue(java.lang.String field,
int value)
throws java.io.IOException
- Sets the value belonging to the given field.
- Parameters:
field
- the name of the fieldvalue
-
- Throws:
java.io.IOException
setValue
public void setValue(int index,
int value)
throws java.io.IOException
- Sets the value belonging to the given field.
- Parameters:
index
- the index of the requested fieldvalue
-
- Throws:
java.io.IOException
setValue
public void setValue(java.lang.String field,
float value)
throws java.io.IOException
- Sets the value belonging to the given field.
- Parameters:
field
- the name of the fieldvalue
-
- Throws:
java.io.IOException
setValue
public void setValue(int index,
float value)
throws java.io.IOException
- Sets the value belonging to the given field.
- Parameters:
index
- the index of the requested fieldvalue
-
- Throws:
java.io.IOException
setValue
public void setValue(java.lang.String field,
long value)
throws java.io.IOException
- Sets the value belonging to the given field.
- Parameters:
field
- the name of the fieldvalue
-
- Throws:
java.io.IOException
setValue
public void setValue(int index,
long value)
throws java.io.IOException
- Sets the value belonging to the given field.
- Parameters:
index
- the index of the requested fieldvalue
-
- Throws:
java.io.IOException
setValue
public void setValue(java.lang.String field,
double value)
throws java.io.IOException
- Sets the value belonging to the given field.
- Parameters:
field
- the name of the fieldvalue
-
- Throws:
java.io.IOException
setValue
public void setValue(int index,
double value)
throws java.io.IOException
- Sets the value belonging to the given field.
- Parameters:
index
- the index of the requested fieldvalue
-
- Throws:
java.io.IOException
setValue
public void setValue(java.lang.String field,
char value)
throws java.io.IOException
- Sets the value belonging to the given field.
- Parameters:
field
- the name of the fieldvalue
-
- Throws:
java.io.IOException
setValue
public void setValue(int index,
char value)
throws java.io.IOException
- Sets the value belonging to the given field.
- Parameters:
index
- the index of the requested fieldvalue
-
- Throws:
java.io.IOException
setValue
public void setValue(java.lang.String field,
byte value)
throws java.io.IOException
- Sets the value belonging to the given field.
- Parameters:
field
- the name of the fieldvalue
-
- Throws:
java.io.IOException
setValue
public void setValue(int index,
byte value)
throws java.io.IOException
- Sets the value belonging to the given field.
- Parameters:
index
- the index of the requested fieldvalue
-
- Throws:
java.io.IOException
getValue
public java.nio.ByteBuffer getValue(java.lang.String field)
throws java.io.IOException
- Returns the value belonging to the given field as read-only ByteBuffer
- Parameters:
field
- the name of the field
- Returns:
- the requested value
- Throws:
java.io.IOException
getValue
public java.nio.ByteBuffer getValue(int index)
throws java.io.IOException
- Returns the value belonging to the given field as read-only ByteBuffer
- Parameters:
index
- the index of the requested field
- Returns:
- the requested value
- Throws:
java.io.IOException
getValueAsInt
public int getValueAsInt(int index)
throws java.io.IOException
- Returns the value belonging to the given field as Int
- Parameters:
index
- the index of the requested field
- Returns:
- the requested value
- Throws:
java.io.IOException
getValueAsInt
public int getValueAsInt(java.lang.String field)
throws java.io.IOException
- Returns the value belonging to the given field as int
- Parameters:
field
- the name of the field
- Returns:
- the requested value
- Throws:
java.io.IOException
getValueAsFloat
public float getValueAsFloat(java.lang.String field)
throws java.io.IOException
- Returns the value belonging to the given field as int
- Parameters:
field
- the name of the field
- Returns:
- the requested value
- Throws:
java.io.IOException
getValueAsFloat
public float getValueAsFloat(int index)
throws java.io.IOException
- Returns the value belonging to the given field as Int
- Parameters:
index
- the index of the requested field
- Returns:
- the requested value
- Throws:
java.io.IOException
getValueAsDouble
public double getValueAsDouble(int index)
throws java.io.IOException
- Returns the value belonging to the given field as long
- Parameters:
index
- the index of the requested field
- Returns:
- the requested value
- Throws:
java.io.IOException
getValueAsDouble
public double getValueAsDouble(java.lang.String field)
throws java.io.IOException
- Returns the value belonging to the given field as long
- Parameters:
field
- the name of the field
- Returns:
- the requested value
- Throws:
java.io.IOException
getValueAsLong
public long getValueAsLong(int index)
throws java.io.IOException
- Returns the value belonging to the given field as long
- Parameters:
index
- the index of the requested field
- Returns:
- the requested value
- Throws:
java.io.IOException
getValueAsLong
public long getValueAsLong(java.lang.String field)
throws java.io.IOException
- Returns the value belonging to the given field as long
- Parameters:
field
- the name of the field
- Returns:
- the requested value
- Throws:
java.io.IOException
getValueAsChar
public char getValueAsChar(int index)
throws java.io.IOException
- Returns the value belonging to the given field as char
- Parameters:
index
- the index of the requested field
- Returns:
- the requested value
- Throws:
java.io.IOException
getValueAsChar
public char getValueAsChar(java.lang.String field)
throws java.io.IOException
- Returns the value belonging to the given field as char
- Parameters:
field
- the name of the field
- Returns:
- the requested value
- Throws:
java.io.IOException
getValueAsByte
public byte getValueAsByte(java.lang.String field)
throws java.io.IOException
- Returns the value belonging to the given field as byte
- Parameters:
field
- the name of the field
- Returns:
- the requested value
- Throws:
java.io.IOException
getValueAsByte
public byte getValueAsByte(int index)
throws java.io.IOException
- Returns the value belonging to the given field as byte
- Parameters:
index
- the index of the requested field
- Returns:
- the requested value
- Throws:
java.io.IOException
setKey
public void setKey(java.lang.String field,
byte[] key)
throws java.io.IOException
- Sets the key belonging to the given field.
- Parameters:
field
- the name of the fieldkey
- the key to set
- Throws:
java.io.IOException
setKey
public void setKey(int index,
byte[] key)
throws java.io.IOException
- Sets the key belonging to the given field.
- Parameters:
index
- the index of the requested fieldkey
- the key to set
- Throws:
java.io.IOException
setKey
public void setKey(java.lang.String field,
int key)
throws java.io.IOException
- Sets the key belonging to the given field.
- Parameters:
field
- the name of the fieldkey
-
- Throws:
java.io.IOException
setKey
public void setKey(int index,
int key)
throws java.io.IOException
- Sets the key belonging to the given field.
- Parameters:
index
- the index of the requested fieldkey
-
- Throws:
java.io.IOException
setKey
public void setKey(int index,
float key)
throws java.io.IOException
- Sets the key belonging to the given field.
- Parameters:
index
- the index of the requested fieldkey
-
- Throws:
java.io.IOException
setKey
public void setKey(java.lang.String field,
float key)
throws java.io.IOException
- Sets the key belonging to the given field.
- Parameters:
field
- the name of the fieldkey
-
- Throws:
java.io.IOException
setKey
public void setKey(java.lang.String field,
double key)
throws java.io.IOException
- Sets the key belonging to the given field.
- Parameters:
field
- the name of the fieldkey
-
- Throws:
java.io.IOException
setKey
public void setKey(int index,
double key)
throws java.io.IOException
- Sets the key belonging to the given field.
- Parameters:
index
- the index of the requested fieldkey
-
- Throws:
java.io.IOException
setKey
public void setKey(java.lang.String field,
long key)
throws java.io.IOException
- Sets the key belonging to the given field.
- Parameters:
field
- the name of the fieldkey
-
- Throws:
java.io.IOException
setKey
public void setKey(int index,
long key)
throws java.io.IOException
- Sets the key belonging to the given field.
- Parameters:
index
- the index of the requested fieldkey
-
- Throws:
java.io.IOException
setKey
public void setKey(java.lang.String field,
char key)
throws java.io.IOException
- Sets the key belonging to the given field.
- Parameters:
field
- the name of the fieldkey
-
- Throws:
java.io.IOException
setKey
public void setKey(int index,
char key)
throws java.io.IOException
- Sets the key belonging to the given field.
- Parameters:
index
- the index of the requested fieldkey
-
- Throws:
java.io.IOException
setKey
public void setKey(java.lang.String field,
byte key)
throws java.io.IOException
- Sets the key belonging to the given field.
- Parameters:
field
- the name of the fieldkey
-
- Throws:
java.io.IOException
setKey
public void setKey(int index,
byte key)
throws java.io.IOException
- Sets the key belonging to the given field.
- Parameters:
index
- the index of the requested fieldkey
-
- Throws:
java.io.IOException
getKey
public java.nio.ByteBuffer getKey(java.lang.String field)
throws java.io.IOException
- Returns the key belonging to the given field as read-only ByteBuffer
- Parameters:
field
- the name of the field
- Returns:
- the requested value
- Throws:
java.io.IOException
getKey
public java.nio.ByteBuffer getKey(int index)
throws java.io.IOException
- Returns the key belonging to the given field as read-only ByteBuffer
- Parameters:
index
- the index of the requested field
- Returns:
- the requested value
- Throws:
java.io.IOException
getKeyAsInt
public int getKeyAsInt(int index)
throws java.io.IOException
- Returns the key belonging to the given field as Int
- Parameters:
index
- the index of the requested field
- Returns:
- the requested value
- Throws:
java.io.IOException
getKeyAsInt
public int getKeyAsInt(java.lang.String field)
throws java.io.IOException
- Returns the key belonging to the given field as int
- Parameters:
field
- the name of the field
- Returns:
- the requested value
- Throws:
java.io.IOException
getKeyAsFloat
public float getKeyAsFloat(int index)
throws java.io.IOException
- Returns the key belonging to the given field as Int
- Parameters:
index
- the index of the requested field
- Returns:
- the requested value
- Throws:
java.io.IOException
getKeyAsFloat
public float getKeyAsFloat(java.lang.String field)
throws java.io.IOException
- Returns the key belonging to the given field as int
- Parameters:
field
- the name of the field
- Returns:
- the requested value
- Throws:
java.io.IOException
getKeyAsLong
public long getKeyAsLong(int index)
throws java.io.IOException
- Returns the key belonging to the given field as long
- Parameters:
index
- the index of the requested field
- Returns:
- the requested value
- Throws:
java.io.IOException
getKeyAsLong
public long getKeyAsLong(java.lang.String field)
throws java.io.IOException
- Returns the key belonging to the given field as long
- Parameters:
field
- the name of the field
- Returns:
- the requested value
- Throws:
java.io.IOException
getKeyAsDouble
public double getKeyAsDouble(int index)
throws java.io.IOException
- Returns the key belonging to the given field as long
- Parameters:
index
- the index of the requested field
- Returns:
- the requested value
- Throws:
java.io.IOException
getKeyAsDouble
public double getKeyAsDouble(java.lang.String field)
throws java.io.IOException
- Returns the key belonging to the given field as long
- Parameters:
field
- the name of the field
- Returns:
- the requested value
- Throws:
java.io.IOException
getKeyAsChar
public char getKeyAsChar(int index)
throws java.io.IOException
- Returns the key belonging to the given field as char
- Parameters:
index
- the index of the requested field
- Returns:
- the requested value
- Throws:
java.io.IOException
getKeyAsChar
public char getKeyAsChar(java.lang.String field)
throws java.io.IOException
- Returns the key belonging to the given field as char
- Parameters:
field
- the name of the field
- Returns:
- the requested value
- Throws:
java.io.IOException
getKeyAsByte
public byte getKeyAsByte(int index)
throws java.io.IOException
- Returns the key belonging to the given field as byte
- Parameters:
index
- the index of the requested field
- Returns:
- the requested value
- Throws:
java.io.IOException
getKeyAsByte
public byte getKeyAsByte(java.lang.String field)
throws java.io.IOException
- Returns the key belonging to the given field as byte
- Parameters:
field
- the name of the field
- Returns:
- the requested value
- Throws:
java.io.IOException
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object