com.atlassian.core.bean
Class EntityObject

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

public class EntityObject
extends Object
implements 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
 Object clone()
           
 boolean equals(Object o)
           
 Date getCreationDate()
           
 Date getCurrentDate()
          Consult the clock to get the current date.
 long getId()
           
 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(Date creationDate)
           
 void setId(long id)
           
 void setLastModificationDate(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 Date getCreationDate()

setCreationDate

public void setCreationDate(Date creationDate)

getLastModificationDate

public Date getLastModificationDate()

setLastModificationDate

public void setLastModificationDate(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 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 Object

equals

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

clone

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


Copyright © 2015 Atlassian. All rights reserved.