wt.util
Class WrappedTimestamp
java.lang.Object
java.util.Date
java.sql.Timestamp
wt.util.WrappedTimestamp
- All Implemented Interfaces:
- Cloneable, Comparable, Externalizable, Serializable
- public class WrappedTimestamp
- extends Timestamp
- implements Externalizable, Cloneable
This class is a thin wrapper around java.sql.Timestamp
that allows the
value to remain in string form as long as possible. Only when accessing and manipulating
the value will the real java.sql.Timestamp
be initialized. This avoids the
overhead of constructing internal java.util.Calendar
objects and performing
timezone conversions unless absolutely necessary.
- See Also:
- Serialized Form
Fields inherited from class java.util.Date |
|
Constructor Summary |
WrappedTimestamp()
Public constructor required by Externalizable interface - DO NOT USE. |
WrappedTimestamp(String time,
int nanos)
Construct a timestamp based on a string representation of the date. |
versionID
private static final String versionID
- See Also:
- Constant Field Values
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
formatString
private static final String formatString
dateFormat
private static SimpleDateFormat dateFormat
oldDateFormat
private static SimpleDateFormat oldDateFormat
initialized
private boolean initialized
time
private String time
nanos
private int nanos
WrappedTimestamp
public WrappedTimestamp(String time,
int nanos)
- Construct a timestamp based on a string representation of the date. The string
should be in a format parsable by a
SimpleDateFormat
using format
string "dd MM yyyy HH:mm:ss z" such as:
"12 08 1995 02:30:00 GMT"
- Parameters:
time
- a string representation of this date.nanos
- fractional seconds (0 to 999,999,999 ns)
WrappedTimestamp
public WrappedTimestamp()
- Public constructor required by
Externalizable
interface - DO NOT USE.
toDate
private static Date toDate(String str)
throws ParseException
- Throws:
ParseException
init
private void init(boolean for_modify)
getNanos
public int getNanos()
setNanos
public void setNanos(int n)
equals
public boolean equals(Timestamp ts)
before
public boolean before(Timestamp ts)
after
public boolean after(Timestamp ts)
getYear
public int getYear()
setYear
public void setYear(int year)
getMonth
public int getMonth()
setMonth
public void setMonth(int month)
getDate
public int getDate()
setDate
public void setDate(int date)
getDay
public int getDay()
getHours
public int getHours()
setHours
public void setHours(int hours)
getMinutes
public int getMinutes()
setMinutes
public void setMinutes(int minutes)
getSeconds
public int getSeconds()
setSeconds
public void setSeconds(int seconds)
getTime
public long getTime()
setTime
public void setTime(long time)
before
public boolean before(Date when)
after
public boolean after(Date when)
equals
public boolean equals(Object obj)
hashCode
public int hashCode()
toString
public String toString()
toLocaleString
public String toLocaleString()
toGMTString
public String toGMTString()
getTimezoneOffset
public int getTimezoneOffset()
clone
public Object clone()
writeExternal
public void writeExternal(ObjectOutput s)
throws IOException
- Specified by:
writeExternal
in interface Externalizable
- Throws:
IOException
readExternal
public void readExternal(ObjectInput s)
throws IOException
- Specified by:
readExternal
in interface Externalizable
- Throws:
IOException