org.synyx.hades.domain
Class AbstractPersistable<PK extends java.io.Serializable>

java.lang.Object
  extended by org.synyx.hades.domain.AbstractPersistable<PK>
Type Parameters:
PK - the tpe of the entity
All Implemented Interfaces:
java.io.Serializable, Persistable<PK>
Direct Known Subclasses:
AbstractAuditable

@MappedSuperclass
public abstract class AbstractPersistable<PK extends java.io.Serializable>
extends java.lang.Object
implements Persistable<PK>

Abstract base class for entities. Allows parameterization of id type and offers a flag determining the "new" state of the entity.

Author:
Oliver Gierke
See Also:
Serialized Form

Constructor Summary
AbstractPersistable()
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 PK getId()
          Returns the id of the entity.
 int hashCode()
           
 boolean isNew()
          Returns if the Persistable is new or was persisted already.
protected  void setId(PK id)
          Sets the id of the entity.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractPersistable

public AbstractPersistable()
Method Detail

getId

public PK getId()
Description copied from interface: Persistable
Returns the id of the entity.

Specified by:
getId in interface Persistable<PK extends java.io.Serializable>
Returns:
the id

setId

protected void setId(PK id)
Sets the id of the entity.

Parameters:
id - the id to set

isNew

public boolean isNew()
Description copied from interface: Persistable
Returns if the Persistable is new or was persisted already.

Specified by:
isNew in interface Persistable<PK extends java.io.Serializable>
Returns:
if the object is new

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

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

hashCode

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


Copyright © 2009-2010 Synyx GmbH & Co. KG. All Rights Reserved.