org.apache.torque.om
Class DateKey

java.lang.Object
  extended by org.apache.torque.om.ObjectKey
      extended by org.apache.torque.om.SimpleKey
          extended by org.apache.torque.om.DateKey
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

public class DateKey
extends SimpleKey

This class can be used as an ObjectKey to uniquely identify an object within an application where the id is a Date.

Version:
$Id: DateKey.java 476550 2006-11-18 16:08:37Z tfischer $
Author:
John McNally
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.torque.om.ObjectKey
key
 
Constructor Summary
DateKey()
          Creates an DateKey whose internal representation will be set later, through a set method
DateKey(java.util.Date key)
          Creates a DateKey
DateKey(DateKey key)
          Creates a DateKey that is equivalent to key.
DateKey(java.lang.String key)
          Creates a DateKey whose internal representation is a Date given by the long number given by the String
 
Method Summary
 boolean equals(java.lang.Object keyObj)
          keyObj is equal to this DateKey if keyObj is a DateKey or String that contains the same information this key contains.
 java.util.Date getDate()
          Access the underlying Date object.
 void setValue(DateKey key)
          Sets the internal representation to the same object used by key.
 void setValue(java.lang.String key)
          Sets the internal representation to a String
 java.lang.String toString()
          get a String representation
 
Methods inherited from class org.apache.torque.om.SimpleKey
keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor
 
Methods inherited from class org.apache.torque.om.ObjectKey
appendTo, compareTo, getValue, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DateKey

public DateKey()
Creates an DateKey whose internal representation will be set later, through a set method


DateKey

public DateKey(java.lang.String key)
Creates a DateKey whose internal representation is a Date given by the long number given by the String

Parameters:
key - the key value
Throws:
java.lang.NumberFormatException - if key is not valid

DateKey

public DateKey(java.util.Date key)
Creates a DateKey

Parameters:
key - the key value

DateKey

public DateKey(DateKey key)
Creates a DateKey that is equivalent to key.

Parameters:
key - the key value
Method Detail

setValue

public void setValue(java.lang.String key)
Sets the internal representation to a String

Specified by:
setValue in class ObjectKey
Parameters:
key - the key value

setValue

public void setValue(DateKey key)
Sets the internal representation to the same object used by key.

Parameters:
key - the key value

getDate

public java.util.Date getDate()
Access the underlying Date object.

Returns:
a Date value

equals

public boolean equals(java.lang.Object keyObj)
keyObj is equal to this DateKey if keyObj is a DateKey or String that contains the same information this key contains. Two ObjectKeys that both contain null values are not considered equal.

Overrides:
equals in class java.lang.Object
Parameters:
keyObj - the comparison value
Returns:
whether the two objects are equal

toString

public java.lang.String toString()
get a String representation

Overrides:
toString in class java.lang.Object
Returns:
a String representation of the Date or an empty String if the Date is null


Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.