org.xins.common.types.standard
Class Timestamp.Value

java.lang.Object
  extended byorg.xins.common.types.standard.Timestamp.Value
All Implemented Interfaces:
Cloneable
Enclosing class:
Timestamp

public static final class Timestamp.Value
extends Object
implements Cloneable

Value for the type _timestamp. Represents a specific moment in time, with second-precision.

Since:
XINS 1.0.0
Version:
$Revision: 1.28 $
Author:
Anthony Goubard, Ernst de Haan

Constructor Summary
Timestamp.Value(Calendar calendar)
          Constructs a new timestamp value based on the specified Calendar.
Timestamp.Value(Date date)
          Constructs a new timestamp value based on the specified java.util.Date object.
Timestamp.Value(int year, int month, int day, int hour, int minute, int second)
          Constructs a new timestamp value.
Timestamp.Value(long millis)
          Constructs a new timestamp value based on the specified number of milliseconds since the UNIX Epoch.
 
Method Summary
 Object clone()
          Creates and returns a copy of this object.
 boolean equals(Object obj)
           
 int getDayOfMonth()
          Returns the day of the month.
 int getHourOfDay()
          Returns the hour of the day.
 int getMinuteOfHour()
          Returns the minute of the hour.
 int getMonthOfYear()
          Returns the month of the year.
 int getSecondOfMinute()
          Returns the second of the minute.
 int getYear()
          Returns the year.
 int hashCode()
           
 Date toDate()
          Converts to a java.util.Date object.
 String toString()
          Returns a textual representation of this object.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Timestamp.Value

public Timestamp.Value(int year,
                       int month,
                       int day,
                       int hour,
                       int minute,
                       int second)
Constructs a new timestamp value. The values will not be checked.

Parameters:
year - the year, including century, e.g. 2005.
month - the month of the year in the range 1-12, e.g. 11 for November.
day - the day of the month in the range 1-31, e.g. 1 for the first day of the month.
hour - the hour of the day in the range 0-23, e.g. 22 for 10 o'clock at night.
minute - the minute of the hour in the range 0-59, e.g. 0 for first minute of the hour.
second - the second of the minute in the range 0-59, e.g. 0 for the first second of the minute.

Timestamp.Value

public Timestamp.Value(Calendar calendar)
                throws IllegalArgumentException
Constructs a new timestamp value based on the specified Calendar.

Parameters:
calendar - the Calendar object to get the exact date from, cannot be null.
Throws:
IllegalArgumentException - if calendar == null.
Since:
XINS 1.2.0

Timestamp.Value

public Timestamp.Value(Date date)
                throws IllegalArgumentException
Constructs a new timestamp value based on the specified java.util.Date object.

Parameters:
date - the Date object to get the exact date from, cannot be null.
Throws:
IllegalArgumentException - if date == null.
Since:
XINS 1.2.0

Timestamp.Value

public Timestamp.Value(long millis)
                throws IllegalArgumentException
Constructs a new timestamp value based on the specified number of milliseconds since the UNIX Epoch.

Parameters:
millis - the number of milliseconds since the UNIX Epoch.
Throws:
IllegalArgumentException - if millis < 0L.
Since:
XINS 1.2.0
See Also:
System.currentTimeMillis()
Method Detail

clone

public Object clone()
Creates and returns a copy of this object.

Returns:
a copy of this object, never null.
See Also:
Object.clone()

getYear

public int getYear()
Returns the year.

Returns:
the year, between 1970 and 2999 (inclusive).

getMonthOfYear

public int getMonthOfYear()
Returns the month of the year.

Returns:
the month of the year, between 1 and 12 (inclusive).

getDayOfMonth

public int getDayOfMonth()
Returns the day of the month.

Returns:
the day of the month, between 1 and 31 (inclusive).

getHourOfDay

public int getHourOfDay()
Returns the hour of the day.

Returns:
the hour of the day, between 0 and 23 (inclusive).

getMinuteOfHour

public int getMinuteOfHour()
Returns the minute of the hour.

Returns:
the minute of the hour, between 0 and 59 (inclusive).

getSecondOfMinute

public int getSecondOfMinute()
Returns the second of the minute.

Returns:
the second of the minute, between 0 and 59 (inclusive).

equals

public boolean equals(Object obj)

hashCode

public int hashCode()

toDate

public Date toDate()
Converts to a java.util.Date object.

Returns:
the Date corresponding to this value.
Since:
XINS 1.2.0

toString

public String toString()
Returns a textual representation of this object.

Returns:
the textual representation of this timestamp, never null.


See http://www.xins.org/.