org.spicefactory.pimento.io
Class AbstractEntitySnapshot

java.lang.Object
  extended by org.spicefactory.pimento.io.AbstractEntitySnapshot
All Implemented Interfaces:
Externalizable, EntitySnapshot
Direct Known Subclasses:
AbstractApplicableEntitySnapshot, ProxyEntitySnapshot

public abstract class AbstractEntitySnapshot
extends Object
implements Externalizable, EntitySnapshot

Abstract EntitySnapshot base implementation.

Author:
Jens Halm

Constructor Summary
protected AbstractEntitySnapshot()
          Creates a new instance.
protected AbstractEntitySnapshot(int metadataId, Object entityId)
          Creates a new instance.
 
Method Summary
 boolean equals(Object other)
           
 Object getEntityId()
          Returns the id of the entity.
 String getLogString(EntityMetadata metadata, boolean includeProperties)
          Returns a log String for this snapshot.
 int getMetadataId()
          Returns the id of the associated metadata.
 int hashCode()
           
 void readExternal(DataInput input)
          Restores the content of this object from the DataInput instance.
 String toString()
           
 void writeExternal(DataOutput output)
          Saves the content of this object to the DataOutput instance.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractEntitySnapshot

protected AbstractEntitySnapshot()
Creates a new instance. The default constructor will only be used by the AMF decoder.


AbstractEntitySnapshot

protected AbstractEntitySnapshot(int metadataId,
                                 Object entityId)
Creates a new instance.

Parameters:
metadataId - the id of the metadata for this entity
entityId - the id of the entity
Method Detail

getMetadataId

public int getMetadataId()
Description copied from interface: EntitySnapshot
Returns the id of the associated metadata. A unique id will be assigned for each persistent class in the JPA configuration that was configured to be managed by Pimento.

Specified by:
getMetadataId in interface EntitySnapshot
Returns:
the id of the associated metadata

getEntityId

public Object getEntityId()
Description copied from interface: EntitySnapshot
Returns the id of the entity. For transient entities a temporary id will be used.

Specified by:
getEntityId in interface EntitySnapshot
Returns:
the id of the entity

readExternal

public void readExternal(DataInput input)
Description copied from interface: Externalizable
Restores the content of this object from the DataInput instance. Values must be read in the same sequence as they were written on the client side.

Specified by:
readExternal in interface Externalizable
Parameters:
input - the AMF3 data to read from

writeExternal

public void writeExternal(DataOutput output)
Description copied from interface: Externalizable
Saves the content of this object to the DataOutput instance.

Specified by:
writeExternal in interface Externalizable
Parameters:
output - the output to write to

getLogString

public String getLogString(EntityMetadata metadata,
                           boolean includeProperties)
Description copied from interface: EntitySnapshot
Returns a log String for this snapshot.

Specified by:
getLogString in interface EntitySnapshot
Parameters:
metadata - the metadata associated with this snapshot
includeProperties - whether properties should be included in the log

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object