com.atlassian.core.bean
Class EntityObject

java.lang.Object
  extended by com.atlassian.core.bean.EntityObject
All Implemented Interfaces:
java.lang.Cloneable

public class EntityObject
extends java.lang.Object
implements java.lang.Cloneable

Common superclass for persistent entities: provides a long key, and creation/modification dates. Also provides a clock for testing.


Constructor Summary
EntityObject()
           
 
Method Summary
 java.lang.Object clone()
           
 boolean equals(java.lang.Object o)
           
 java.util.Date getCreationDate()
           
 java.util.Date getCurrentDate()
          Consult the clock to get the current date.
 long getId()
           
 java.util.Date getLastModificationDate()
           
 int hashCode()
           
 void setClock(Clock clock)
          The clock is used to fool the entity into thinking that the current time is different to what it actually is.
 void setCreationDate(java.util.Date creationDate)
           
 void setId(long id)
           
 void setLastModificationDate(java.util.Date lastModificationDate)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityObject

public EntityObject()
Method Detail

getId

public long getId()

setId

public void setId(long id)

getCreationDate

public java.util.Date getCreationDate()

setCreationDate

public void setCreationDate(java.util.Date creationDate)

getLastModificationDate

public java.util.Date getLastModificationDate()

setLastModificationDate

public void setLastModificationDate(java.util.Date lastModificationDate)

setClock

public void setClock(Clock clock)
The clock is used to fool the entity into thinking that the current time is different to what it actually is. Used in tests so we get consistent results with time-based activities.


getCurrentDate

public java.util.Date getCurrentDate()
Consult the clock to get the current date.

Returns:
the current date as per the clock set in #setClock, or new Date() if no clock is set

hashCode

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

equals

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

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.