com.objectwave.persist.util
Class DateWithoutTime

java.lang.Object
  |
  +--com.objectwave.persist.util.DateWithoutTime
All Implemented Interfaces:
ScalarType, java.io.Serializable

public class DateWithoutTime
extends java.lang.Object
implements ScalarType, java.io.Serializable

When building a SQLInsert statement, we had a problem where we had no way of knowing if a given field of class java.util.Date should be formatted to be accepted as a DATE or a DATETIME. Thus this class has been created to be able to check these types. The persistent object's class should define a given field to be of type DateWithoutTime if it's corresponding database column is of type DATE. Simply put, use the following mapping: table column of type DATE --> use the DateWithoutType class table column of type DATETIME --> use the Date class

Version:
$Id: DateWithoutTime.java,v 2.1 2002/01/21 22:34:50 dave_hoag Exp $
Author:
jay
See Also:
Serialized Form

Constructor Summary
DateWithoutTime()
          Constructor for the DateWithoutTime object
DateWithoutTime(java.util.Date d)
          Constructor for the DateWithoutTime object
DateWithoutTime(long d)
          Constructor for the DateWithoutTime object
 
Method Summary
 boolean after(DateWithoutTime dwt)
           
 boolean before(DateWithoutTime dwt)
           
 boolean equals(java.lang.Object o)
           
 long getTime()
          Gets the Time attribute of the DateWithoutTime object
static void main(java.lang.String[] args)
           
static void setDateFormat(java.text.SimpleDateFormat newFormat)
          Sets the DateFormat attribute of the DateWithoutTime class
 void setTime(long time)
          Sets the Time attribute of the DateWithoutTime object
 java.lang.String toDatabaseString()
          This method was created in VisualAge.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DateWithoutTime

public DateWithoutTime()
Constructor for the DateWithoutTime object


DateWithoutTime

public DateWithoutTime(long d)
Constructor for the DateWithoutTime object

Parameters:
d -

DateWithoutTime

public DateWithoutTime(java.util.Date d)
Constructor for the DateWithoutTime object

Parameters:
d -
Method Detail

setDateFormat

public static void setDateFormat(java.text.SimpleDateFormat newFormat)
Sets the DateFormat attribute of the DateWithoutTime class

Parameters:
newFormat - The new DateFormat value

main

public static void main(java.lang.String[] args)
Parameters:
args -

setTime

public void setTime(long time)
Sets the Time attribute of the DateWithoutTime object

Parameters:
time - The new Time value

getTime

public long getTime()
Gets the Time attribute of the DateWithoutTime object

Returns:
The Time value

after

public boolean after(DateWithoutTime dwt)
Parameters:
dwt -
Returns:

before

public boolean before(DateWithoutTime dwt)
Parameters:
dwt -
Returns:

equals

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

toDatabaseString

public java.lang.String toDatabaseString()
This method was created in VisualAge.

Specified by:
toDatabaseString in interface ScalarType
Returns:
java.lang.String

toString

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