public class DateRange extends Object implements Serializable
Constructor and Description |
---|
DateRange()
Creates an empty date range.
|
DateRange(DateRange range)
Clone constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Compares two date ranges.
|
Calendar |
getCalendar()
Gets a
Calendar representation of the date range. |
int |
getDay()
Day to be shown, or 0 if not limited by day.
|
Calendar |
getFromDate()
Gets the starting date of this date range.
|
int |
getMonth()
Month to be shown, or 0 if not limited by month.
|
Calendar |
getThruDate()
Gets the ending date of this date range (inclusive).
|
int |
getYear()
Year to be shown, or 0 if not limited by year.
|
int |
hashCode() |
boolean |
isEmpty()
Checks if the Date Range is unset.
|
static DateRange |
parse(String string)
Creates a
DateRange by parsing a string. |
void |
setDate(Date date)
Sets the day, month and year according to the given
Date . |
void |
setDay(int day) |
void |
setMonth(int month) |
void |
setYear(int year) |
String |
toString()
Returns a string representation of this
DateRange . |
public DateRange()
public static DateRange parse(String string)
DateRange
by parsing a string. Valid strings are e.g.:
null
: empty date rangestring
- String to be parsed, may be null
DateRange
containing the dateIllegalArgumentException
- if the date is not validpublic int getYear()
public void setYear(int year)
public int getMonth()
public void setMonth(int month)
public int getDay()
public void setDay(int day)
public boolean isEmpty()
public void setDate(Date date)
Date
.date
- Date
to set the calendar settings forpublic Calendar getCalendar()
Calendar
representation of the date range.Calendar
instancepublic Calendar getFromDate()
Calendar
instance with the starting datepublic Calendar getThruDate()
Calendar
instance with the ending date (inclusive)public boolean equals(Object obj)
Copyright © 2009–2016. All rights reserved.