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

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

public static final class Date.Value
extends Object
implements Cloneable

Value for the type _date. Represents a specific moment in time, with day-precision.

Since:
XINS 1.0.0
Version:
$Revision: 1.38 $ $Date: 2008/07/04 10:22:44 $
Author:
Ernst de Haan

Constructor Summary
Date.Value(Calendar calendar)
          Constructs a new date value based on the specified Calendar.
Date.Value(Date date)
          Constructs a new date value based on the specified java.util.Date object.
Date.Value(int year, int month, int day)
          Constructs a new date value.
Date.Value(long millis)
          Constructs a new date 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 getMonthOfYear()
          Returns the month of the year.
 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

Date.Value

public Date.Value(int year,
                  int month,
                  int day)
Constructs a new date value. The values will not be checked.

Parameters:
year - the year, e.g. 2005.
month - the month of the year, e.g. 11 for November.
day - the day of the month, e.g. 1 for the first day of the month.

Date.Value

public Date.Value(Calendar calendar)
           throws IllegalArgumentException
Constructs a new date 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

Date.Value

public Date.Value(Date date)
           throws IllegalArgumentException
Constructs a new date 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

Date.Value

public Date.Value(long millis)
           throws IllegalArgumentException
Constructs a new date 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).

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/.