org.spicefactory.pimento.io
Class EntitySnapshot

java.lang.Object
  extended by org.spicefactory.pimento.io.TypeSnapshot
      extended by org.spicefactory.pimento.io.EntitySnapshot
All Implemented Interfaces:
Externalizable

public class EntitySnapshot
extends TypeSnapshot

Disassembled snapshot representation of a persistent entity type.

Author:
Jens Halm

Field Summary
 
Fields inherited from class org.spicefactory.pimento.io.TypeSnapshot
EMPTY, FULL, PARTIAL, propertyValues
 
Constructor Summary
EntitySnapshot()
          Creates a new instance.
EntitySnapshot(Object instance, Entity entity)
          Creates a new instance.
 
Method Summary
 boolean equals(Object other)
           
 Object getEntityId()
          Returns the id of the entity.
 int getTransientId()
          Returns the temporary id in case this snapshot represents a transient entity.
 int getTypeHandle()
          Returns the type handle of the associated entity.
 int hashCode()
           
 void readExternal(DataInput input)
          Restores the content of this object from the DataInput instance.
 void writeExternal(DataOutput output)
          Saves the content of this object to the DataOutput instance.
 
Methods inherited from class org.spicefactory.pimento.io.TypeSnapshot
addProperty, addProperty, getPropertyIterator, isEmpty, isPartial, readProperties, writeProperties
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntitySnapshot

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


EntitySnapshot

public EntitySnapshot(Object instance,
                      Entity entity)
Creates a new instance.

Parameters:
instance - the instance to create a snapshot for
entity - the metamodel for the entity
Method Detail

getTypeHandle

public int getTypeHandle()
Returns the type handle of the associated entity. A unique id will be assigned for each persistent class in the JPA configuration that was configured to be managed by Pimento.

Returns:
the type handle of the associated entity

getEntityId

public Object getEntityId()
Returns the id of the entity.

Returns:
the id of the entity

getTransientId

public int getTransientId()
Returns the temporary id in case this snapshot represents a transient entity.

Returns:
the temporary id in case this snapshot represents a transient 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
Overrides:
readExternal in class TypeSnapshot
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
Overrides:
writeExternal in class TypeSnapshot
Parameters:
output - the output to write to

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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