net.sourceforge.domian.entity
Class AbstractEntity
java.lang.Object
net.sourceforge.domian.entity.AbstractEntity
- All Implemented Interfaces:
- Entity
- Direct Known Subclasses:
- AbstractRandomIntegerEntity, AbstractRandomLongEntity, AbstractUUIDEntity
public abstract class AbstractEntity
- extends java.lang.Object
- implements Entity
Abstract class for all entity objects, ensuring consistent/unchanging
equals
/hashCode
methods, not influenced by mutable state.
Also, the time of creation is recorded and available.
- Since:
- 0.4
- Author:
- Eirik Torske
Field Summary |
protected java.lang.Long |
timeOfCreation
|
protected java.lang.Integer |
version
For possible use of RDBMS optimistic locking. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
timeOfCreation
protected final java.lang.Long timeOfCreation
version
protected java.lang.Integer version
- For possible use of RDBMS optimistic locking.
AbstractEntity
public AbstractEntity()
getVersion
public java.lang.Integer getVersion()
setVersion
public void setVersion(java.lang.Integer version)
getTimeOfCreation
public final java.lang.Long getTimeOfCreation()
- Description copied from interface:
Entity
- An entity object always originates from one specific moment in time.
- Specified by:
getTimeOfCreation
in interface Entity
- Returns:
- the time of creation of this entity, in milliseconds after 01.01.1970
isEntity
public final java.lang.Boolean isEntity()
isValueObject
public final java.lang.Boolean isValueObject()
hashCode
public final int hashCode()
- Overrides:
hashCode
in class java.lang.Object
equals
public final boolean equals(java.lang.Object otherObject)
- Overrides:
equals
in class java.lang.Object
doWarnLog
protected void doWarnLog(java.lang.String message)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright © 2006-2010. All Rights Reserved.