net.sourceforge.sqlunit.types
Class TimestampType

java.lang.Object
  extended by net.sourceforge.sqlunit.types.UnsupportedType
      extended by net.sourceforge.sqlunit.types.TimestampType
All Implemented Interfaces:
java.lang.Comparable, IType

public class TimestampType
extends UnsupportedType

Models a TIMESTAMP type.

Version:
$Revision: 1.10 $
Author:
Ralph Brendler (rbrendler@users.sourceforge.net), Sujit Pal (spal@users.sourceforge.net)

Field Summary
protected static java.lang.String PATTERN
          Specifies the pattern for the DATE object.
 
Constructor Summary
TimestampType()
           
 
Method Summary
 int compareTo(java.lang.Object obj)
          Returns a negative, zero or positive number according to whether this object is smaller, equal or larger than the passed in object.
 boolean equals(java.lang.Object obj)
          Returns true if this TimestampType is equal to the one passed in.
protected  java.lang.String format(java.lang.Object obj)
          Formats a TIMESTAMP into its String representation.
 int hashCode()
          Returns the hashcode for the underlying wrapped datatype.
protected  java.lang.Object parse(java.lang.String str)
          Parses a String representing a TIMESTAMP to a Timestamp.
 
Methods inherited from class net.sourceforge.sqlunit.types.UnsupportedType
formatString, getId, getName, getValue, setId, setName, setValue, toObject, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATTERN

protected static java.lang.String PATTERN
Specifies the pattern for the DATE object. This may be overriden in subclasses to work with alternate forms of the TIMESTAMP type in different databases.

Constructor Detail

TimestampType

public TimestampType()
Method Detail

format

protected java.lang.String format(java.lang.Object obj)
                           throws SQLUnitException
Formats a TIMESTAMP into its String representation.

Overrides:
format in class UnsupportedType
Parameters:
obj - an Object to be converted to the IType interface.
Returns:
the String representation of the object.
Throws:
SQLUnitException - if the formatting failed.

parse

protected java.lang.Object parse(java.lang.String str)
                          throws SQLUnitException
Parses a String representing a TIMESTAMP to a Timestamp.

Overrides:
parse in class UnsupportedType
Parameters:
str - the String representation of the TIMESTAMP.
Returns:
a java.sql.Time object.
Throws:
SQLUnitException - if the parsing failed.

equals

public final boolean equals(java.lang.Object obj)
Returns true if this TimestampType is equal to the one passed in.

Overrides:
equals in class UnsupportedType
Parameters:
obj - the Object to compare against.
Returns:
true or false.

hashCode

public final int hashCode()
Returns the hashcode for the underlying wrapped datatype.

Overrides:
hashCode in class UnsupportedType
Returns:
the hashcode for the underlying datatype.

compareTo

public final int compareTo(java.lang.Object obj)
Returns a negative, zero or positive number according to whether this object is smaller, equal or larger than the passed in object.

Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class UnsupportedType
Parameters:
obj - an Object of type TimestampType.
Returns:
a negative, zero or positive number.