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:
Serializable, Comparable<Object>

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 1351125 2012-06-17 16:51:03Z tv $
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(Date key)
          Creates a DateKey
DateKey(DateKey key)
          Creates a DateKey that is equivalent to key.
DateKey(String key)
          Creates a DateKey whose internal representation is a Date given by the long number given by the String
 
Method Summary
 Date getDate()
          Access the underlying Date object.
 int getJdbcType()
          Returns the JDBC type of the key as defined in java.sql.Types.
 void setValue(DateKey key)
          Sets the internal representation to the same object used by key.
 void setValue(String key)
          Sets the internal representation to a String
 String toString()
          Get a String representation for this key.
 
Methods inherited from class org.apache.torque.om.SimpleKey
keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor, keyFor
 
Methods inherited from class org.apache.torque.om.ObjectKey
appendTo, compareTo, equals, 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(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:
NumberFormatException - if key is not valid

DateKey

public DateKey(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(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

getJdbcType

public int getJdbcType()
Returns the JDBC type of the key as defined in java.sql.Types.

Specified by:
getJdbcType in class ObjectKey
Returns:
Types.TIMESTAMP.

getDate

public Date getDate()
Access the underlying Date object.

Returns:
a Date value

toString

public String toString()
Get a String representation for this key.

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


Copyright © 2000-2013 The Apache Software Foundation. All Rights Reserved.