public class DateTimeRange
extends java.lang.Object
DateTime
.
Since dateTimeRange
is a superclass of date
and dateTime
, a DateTimeRange object can sometimes be
used to represent a single date or dateTime. When this is the case,
the start and end value will be identical and isDateTimeOnly()
will return true. You can then get the DateTime
the 'range'
corresponds to using toDateTime()
.Constructor and Description |
---|
DateTimeRange(DateTime dateTime)
Creates a new range that is actually a date or a dateTime.
|
DateTimeRange(DateTime start,
DateTime end)
Creates a new range.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
DateTime |
getEnd()
Gets the end date or date/time.
|
DateTime |
getStart()
Gets the start date or date+time.
|
int |
hashCode() |
boolean |
isDateTimeOnly()
Checks whether this is a real range, with a start and an
end date, or a date/dateTime posing as a range.
|
DateTime |
toDateTime()
Converts empty ranges into
DateTime . |
java.lang.String |
toString()
Returns the canonical string representation for a range, as used
in the XML (start " " end).
|
public DateTimeRange(DateTime start, DateTime end)
start
- end
- java.lang.IllegalArgumentException
- if either start or end is nullpublic DateTimeRange(DateTime dateTime)
isDateTimeOnly()
and then converted
using toDateTime()
.dateTime
- public boolean isDateTimeOnly()
DateTime
object this object corresponds to using toDateTime()
public DateTime toDateTime()
DateTime
.java.lang.IllegalStateException
- if the start and end date are
distinct, which means the dateTimeRange is neither a date
nor a dateTime (see isDateTimeOnly()
)public DateTime getStart()
public DateTime getEnd()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object