org.openbandy.io
Interface Serializable

All Known Implementing Classes:
Car, Crankshaft, Engine, EuropeanSportscar, Message, PingPongMessage, SerializableVector, Sportscar, Tire

public interface Serializable


Method Summary
 void deserialize(Serializer serializer, SerializationBuffer serializationBuffer)
          This method must overwrite the attributes denoted in getAttributeNames() with values read from the container provided.
 void getAttributeNames(java.util.Vector attributes)
          This method must put the name of every attribute that needs to be serialized in the given Vector.
 Serializable getCopy()
          Must return a copy of the object that is equal according to the method isEuqalTo().
 java.lang.String getIdName()
          Must return the name of the id (e.g.
 int getIdValue()
          Must return the value of the id.
 java.lang.String getLegibleString()
          Must return a human readable String representation of the object.
 Serializable getNewInstance()
          Must return a new and initialized instance.
 void getReferencedIdNames(java.util.Vector referencedIdNames)
          This method must put every id name of referenced objects, i.e.
 void getReferences(java.util.Vector references)
          This method must put every reference to Serializable objects, i.e.
 boolean isEqual(Serializable serializableObject)
          Must return true if the serializableObject is equal to this, except for the id but INCLUDING equality of referenced serializables.
 boolean isEqualShallow(Serializable serializableObject)
          Must return true if the serializableObject is equal to this, except for the id, EXCLUDING equality of referenced serializables.
 void serialize(Serializer serializer, SerializationBuffer serializationBuffer)
          This method must fill the container provided with the serialization- Object with values for every attribute denoted in getAttributeNames().
 void setIdValue(int idValue)
          Set the id to the given value.
 

Method Detail

serialize

void serialize(Serializer serializer,
               SerializationBuffer serializationBuffer)
This method must fill the container provided with the serialization- Object with values for every attribute denoted in getAttributeNames(). Subsequently it must serialize member objects as denoted in getReferences().

Parameters:
serializer - - the serializer used for call-backs
serializationBuffer - - the serializationBuffer containing the container to write values to

deserialize

void deserialize(Serializer serializer,
                 SerializationBuffer serializationBuffer)
This method must overwrite the attributes denoted in getAttributeNames() with values read from the container provided. Subsequently it must de- serialize member objects as denoted in getReferences().

Parameters:
serializer - - the serializer used for call-backs
serializationBuffer - - the buffer to read values from

getIdName

java.lang.String getIdName()
Must return the name of the id (e.g. eventId).

Returns:
the name of the id

getIdValue

int getIdValue()
Must return the value of the id.

Returns:
the actual value of id

setIdValue

void setIdValue(int idValue)
Set the id to the given value.

Parameters:
idValue - - the new id value

getAttributeNames

void getAttributeNames(java.util.Vector attributes)
This method must put the name of every attribute that needs to be serialized in the given Vector. For every String value contained in attributes, there must be a corresponding field in the database for example.

Parameters:
attributes - - the vector to be filled

getReferences

void getReferences(java.util.Vector references)
This method must put every reference to Serializable objects, i.e. member objects, in the given Vector.

Parameters:
references - - the vector to be filled

getReferencedIdNames

void getReferencedIdNames(java.util.Vector referencedIdNames)
This method must put every id name of referenced objects, i.e. member objects that need to be serialized, in the given Vector.

Parameters:
referencedIdNames - - the vector to be filled

getLegibleString

java.lang.String getLegibleString()
Must return a human readable String representation of the object.

Returns:
human legible string

isEqual

boolean isEqual(Serializable serializableObject)
                throws java.lang.ClassCastException
Must return true if the serializableObject is equal to this, except for the id but INCLUDING equality of referenced serializables.

Parameters:
serializableObject - - the object to compare
Returns:
true if serializableObject is equal to this
Throws:
java.lang.ClassCastException

isEqualShallow

boolean isEqualShallow(Serializable serializableObject)
                       throws java.lang.ClassCastException
Must return true if the serializableObject is equal to this, except for the id, EXCLUDING equality of referenced serializables.

Parameters:
serializableObject - - the object to compare
Returns:
true if serializableObject is equal to this
Throws:
java.lang.ClassCastException

getNewInstance

Serializable getNewInstance()
Must return a new and initialized instance.

Returns:
New instance of concrete class.

getCopy

Serializable getCopy()
Must return a copy of the object that is equal according to the method isEuqalTo().

Returns:
copy of this