org.openbandy.io.db
Class DatabaseValueContainer
java.lang.Object
org.openbandy.io.ValueContainer
org.openbandy.io.storage.StorageValueContainer
org.openbandy.io.db.DatabaseValueContainer
public class DatabaseValueContainer
- extends StorageValueContainer
ValueContainer compliant representation of object data in order
to be stored to and loaded from database.
Every object has its own entry in tables
along with a constraint
indicating whether we need to update or replace data. The TableEntry
in tables then contains a hash table representing every attribute of the object.
(c) Copyright Philipp Bolliger 2007, ALL RIGHTS RESERVED.
- Version:
- 1.0
- Author:
- Philipp Bolliger (philipp@bolliger.name)
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DatabaseValueContainer
public DatabaseValueContainer(ObjectEntry tableEntry)
DatabaseValueContainer
public DatabaseValueContainer(java.sql.ResultSet resultSet)
addTimestamp
public void addTimestamp(java.lang.String name,
long value)
- Overrides:
addTimestamp
in class ValueContainer
- Parameters:
name
- -
the name of the attributevalue
- -
the value of the timestamp defined as milliseconds since
midnight, January 1, 1970 UTC
getString
public java.lang.String getString(java.lang.String name)
- Specified by:
getString
in class ValueContainer
- Parameters:
name
- -
the name of the attribute
- Returns:
- Returns the corresponding String value if available, null else
getByte
public byte getByte(java.lang.String name)
- Overrides:
getByte
in class ValueContainer
- Parameters:
name
- -
the name of the attribute
- Returns:
- Returns the corresponding byte value if available, 0 else
getShort
public short getShort(java.lang.String name)
- Overrides:
getShort
in class ValueContainer
- Parameters:
name
- -
the name of the attribute
- Returns:
- Returns the corresponding short value if available, 0 else
getInt
public int getInt(java.lang.String name)
- Overrides:
getInt
in class ValueContainer
- Parameters:
name
- -
the name of the attribute
- Returns:
- Returns the corresponding int value if available, 0 else
getLong
public long getLong(java.lang.String name)
- Overrides:
getLong
in class ValueContainer
- Parameters:
name
- -
the name of the attribute
- Returns:
- Returns the corresponding long value if available, 0L else
getFloat
public float getFloat(java.lang.String name)
- Overrides:
getFloat
in class ValueContainer
- Parameters:
name
- -
the name of the attribute
- Returns:
- Returns the corresponding float value if available, 0.0f else
getDouble
public double getDouble(java.lang.String name)
- Overrides:
getDouble
in class ValueContainer
- Parameters:
name
- -
the name of the attribute
- Returns:
- Returns the corresponding double value if available, 0.0d else
getTimestamp
public long getTimestamp(java.lang.String name)
- Overrides:
getTimestamp
in class ValueContainer
- Parameters:
name
- -
the name of the attribute
- Returns:
- Returns the timestamp value defined as milliseconds since
midnight, January 1, 1970 UTC if available, 0.0 else