|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pivot.util.CalendarDate
public final class CalendarDate
CalendarDate allows a specific day to be identified within the Gregorian calendar system. This identification has no association with any particular time zone and no notion of the time of day.
Nested Class Summary | |
---|---|
static class |
CalendarDate.Range
Represents a range of calendar dates. |
Field Summary | |
---|---|
int |
day
The day of the month, 0-based. |
int |
month
The month field, 0-based. |
int |
year
The year field. |
Constructor Summary | |
---|---|
CalendarDate()
Creates a new CalendarDate representing the current day in the default timezone and the default locale. |
|
CalendarDate(GregorianCalendar calendar)
Creates a new CalendarDate representing the day contained in the specified Gregorian calendar (assuming the default locale and the default timezone). |
|
CalendarDate(int year,
int month,
int day)
Creates a new CalendarDate representing the specified year, month, and day of month. |
Method Summary | |
---|---|
CalendarDate |
add(int days)
Adds the specified number of days to this calendar date and returns the resulting calendar date. |
int |
compareTo(CalendarDate calendarDate)
Compares this calendar date with another calendar date. |
static CalendarDate |
decode(String value)
Creates a new date representing the specified date string. |
boolean |
equals(Object o)
Indicates whether some other object is "equal to" this one. |
static int |
getMaximumSupportedYear()
Return the maximum supported year. |
static int |
getMinimumSupportedYear()
Return the minimum supported year. |
int |
hashCode()
Returns a hash code value for the object. |
int |
subtract(CalendarDate calendarDate)
Gets the number of days in between this calendar date and the specified calendar date. |
GregorianCalendar |
toCalendar()
Translates this calendar date to an instance of GregorianCalendar, with the year, month, and dayOfMonth fields set in the default time zone with the default locale. |
GregorianCalendar |
toCalendar(Time time)
Translates this calendar date to an instance of GregorianCalendar, with the year, month, and dayOfMonth fields set in the default time zone with the default locale. |
String |
toString()
Returns a string representation of this calendar date in the ISO 8601 "calendar date" format, which is [YYYY]-[MM]-[DD]. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final int year
public final int month
public final int day
Constructor Detail |
---|
public CalendarDate()
public CalendarDate(GregorianCalendar calendar)
calendar
- The calendar containing the year, month, and day fields.public CalendarDate(int year, int month, int day)
year
- The year field. (e.g. 2008)month
- The month field, 0-based. (e.g. 2 for March)day
- The day of the month, 0-based. (e.g. 14 for the 15th)Method Detail |
---|
public static int getMinimumSupportedYear()
org.apache.pivot.wtk.CalendarButton
get the right range of years, which should be this value up to and including
getMaximumSupportedYear()
.
public static int getMaximumSupportedYear()
org.apache.pivot.wtk.CalendarButton
get the right range of years, which should be getMinimumSupportedYear()
up to and including this value.
public CalendarDate add(int days)
More formally, it is defined that given calendar dates c1 and c2, the following will return true:
c1.add(c2.subtract(c1)).equals(c2);
days
- The number of days to add to (or subtract from if negative) this
calendar date.
public int subtract(CalendarDate calendarDate)
More formally, it is defined that given calendar dates c1 and c2, the following will return true:
c1.add(c2.subtract(c1)).equals(c2);
calendarDate
- The calendar date to subtract from this calendar date.
public GregorianCalendar toCalendar()
public GregorianCalendar toCalendar(Time time)
time
- The time of day.
public int compareTo(CalendarDate calendarDate)
compareTo
in interface Comparable<CalendarDate>
calendarDate
- The calendar date against which to compare.
public boolean equals(Object o)
equals
in class Object
o
- Reference to the object against which to compare.public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public static CalendarDate decode(String value)
value
- A string in the form of [YYYY]-[MM]-[DD] (e.g. 2008-07-23).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |