org.sourceforge.jemm.types
Class JemmDate

java.lang.Object
  extended by org.sourceforge.jemm.types.JemmDate
All Implemented Interfaces:
java.io.Serializable

public final class JemmDate
extends java.lang.Object
implements java.io.Serializable

JemmDate is an immutable date class. This allows it to be stored as a valuetype like Integer

Author:
Rory Graves
See Also:
Serialized Form

Constructor Summary
JemmDate(java.util.Date date)
          Create a new JemmDate representing the same date/time as the given java.util.Date.
JemmDate(long timestamp)
          Create a new JemmDate given the number of milliseconds since January 1, 1970, 00:00:00 GMT.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.util.Date getAsDate()
          Return this date value as a Date.
 java.sql.Date getAsSqlDate()
          Return this date value as an sql Date.
 long getTime()
          Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JemmDate

public JemmDate(java.util.Date date)
Create a new JemmDate representing the same date/time as the given java.util.Date.

Parameters:
date - The date to initialise from.

JemmDate

public JemmDate(long timestamp)
Create a new JemmDate given the number of milliseconds since January 1, 1970, 00:00:00 GMT.

Parameters:
timestamp - the number of milliseconds since January 1, 1970, 00:00:00 GMT of this time.
Method Detail

getAsDate

public java.util.Date getAsDate()
Return this date value as a Date.

Returns:
The represented date value as a java.util.Date

getAsSqlDate

public java.sql.Date getAsSqlDate()
Return this date value as an sql Date.

Returns:
The represented date value as a java.sql.Date

getTime

public long getTime()
Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.

Returns:
the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this date.
See Also:
Date.getTime()

hashCode

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

equals

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


Copyright © 2009. All Rights Reserved.