org.jtheque.core.managers.persistence
Class Entity

java.lang.Object
  extended by org.jtheque.core.managers.persistence.Entity
All Implemented Interfaces:
java.lang.Comparable<Entity>

public abstract class Entity
extends java.lang.Object
implements java.lang.Comparable<Entity>

Represents a persisted object of JTheque.

Author:
Baptiste Wicht

Field Summary
static int HASHCODEPRIME
           
 
Constructor Summary
Entity()
          Construct a new Entity.
 
Method Summary
 int compareTo(Entity object)
           
abstract  boolean equals(java.lang.Object object)
           
abstract  java.lang.String getAffichableText()
          Return an affichable text of the Entity.
 int getId()
          Return the id of this Entity.
 TemporaryContext getTemporaryContext()
          Return the temporary context of the data.
abstract  int hashCode()
           
 boolean isSaved()
          Indicate if the entity is saved or not.
 void restoreMemento()
          Restore the state of the data object from the memento.
 void saveToMemento()
          Save the state of the data object to a memento.
 void setId(int id)
          Set the id of this Entity.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HASHCODEPRIME

public static final int HASHCODEPRIME
See Also:
Constant Field Values
Constructor Detail

Entity

public Entity()
Construct a new Entity.

Method Detail

getTemporaryContext

public TemporaryContext getTemporaryContext()
Return the temporary context of the data.

Returns:
The temporary context of the data.

getId

public final int getId()
Return the id of this Entity.

Returns:
The id

setId

public final void setId(int id)
Set the id of this Entity.

Parameters:
id - The new id to set

getAffichableText

public abstract java.lang.String getAffichableText()
Return an affichable text of the Entity. This is not the same as toString(). This method provide an text of display on the application.

Returns:
A string representation of the Entity.

compareTo

public final int compareTo(Entity object)
Specified by:
compareTo in interface java.lang.Comparable<Entity>

equals

public abstract boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

hashCode

public abstract int hashCode()
Overrides:
hashCode in class java.lang.Object

isSaved

public final boolean isSaved()
Indicate if the entity is saved or not.

Returns:
true if the entity is saved, else false.

saveToMemento

public void saveToMemento()
Save the state of the data object to a memento. By default this method isn't supported by Entity.


restoreMemento

public void restoreMemento()
Restore the state of the data object from the memento. By default this method isn't supported by Entity.



Copyright © 2009 JTheque. All Rights Reserved.