public class RelativeIso8601Date extends Iso8601Date
Iso8601Date, but also comes in a "lazy now" flavor.
When "lazy now" mode is enabled, this instance's date value is undefined until the first time it is queried, at which time it is set to
System.currentTimeMillis(). This value is returned on subsequent queries, so it is consistent.
The "lazy state" is conveyed via toString(). A "lazy now" instance will answer toString() with
LAZY_NOW_LABEL if the time has not yet been queried/set, or a Iso8601Date-formatted date of the query time if it
has been queried. This characteristic is useful for serialization and persistence purposes.
Consumers can create "lazy now" instances via the generateLazyNowInstance() factory method or by passing LAZY_NOW_LABEL to
RelativeIso8601Date(String).| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
LAZY_NOW_LABEL |
| Constructor and Description |
|---|
RelativeIso8601Date(java.util.Date date) |
RelativeIso8601Date(java.lang.String dateStr) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
after(java.util.Date when) |
boolean |
before(java.util.Date when) |
java.lang.Object |
clone() |
int |
compareTo(java.util.Date anotherDate) |
boolean |
equals(java.lang.Object obj) |
static RelativeIso8601Date |
generateLazyNowInstance()
Returns a "lazy now" instance.
|
int |
getDate()
Deprecated.
|
int |
getDay()
Deprecated.
|
int |
getHours()
Deprecated.
|
int |
getMinutes()
Deprecated.
|
int |
getMonth()
Deprecated.
|
int |
getSeconds()
Deprecated.
|
long |
getTime() |
int |
getTimezoneOffset()
Deprecated.
|
int |
getYear()
Deprecated.
|
int |
hashCode() |
void |
setDate(int date)
Deprecated.
|
void |
setHours(int hours)
Deprecated.
|
void |
setMinutes(int minutes)
Deprecated.
|
void |
setMonth(int month)
Deprecated.
|
void |
setSeconds(int seconds)
Deprecated.
|
void |
setTime(long time)
Deprecated.
|
void |
setYear(int year)
Deprecated.
|
java.lang.String |
toString()
Returns a
String representation of this date. |
public static final java.lang.String LAZY_NOW_LABEL
public RelativeIso8601Date(java.util.Date date)
public RelativeIso8601Date(java.lang.String dateStr)
public static RelativeIso8601Date generateLazyNowInstance()
public java.lang.String toString()
String representation of this date.toString in class Iso8601DateIso8601Date-formatted string, or the value of LAZY_NOW_LABEL if this is a "lazy now" instance.public long getTime()
getTime in class java.util.Datepublic boolean after(java.util.Date when)
after in class java.util.Datepublic boolean before(java.util.Date when)
before in class java.util.Datepublic java.lang.Object clone()
clone in class java.util.Datepublic int compareTo(java.util.Date anotherDate)
compareTo in interface java.lang.Comparable<java.util.Date>compareTo in class java.util.Datepublic boolean equals(java.lang.Object obj)
equals in class java.util.Date@Deprecated public int getDate()
getDate in class java.util.Date@Deprecated public int getDay()
getDay in class java.util.Date@Deprecated public int getHours()
getHours in class java.util.Date@Deprecated public int getMinutes()
getMinutes in class java.util.Date@Deprecated public int getMonth()
getMonth in class java.util.Date@Deprecated public int getSeconds()
getSeconds in class java.util.Date@Deprecated public int getTimezoneOffset()
getTimezoneOffset in class java.util.Date@Deprecated public int getYear()
getYear in class java.util.Datepublic int hashCode()
hashCode in class java.util.Date@Deprecated public void setDate(int date)
setDate in class java.util.Date@Deprecated public void setHours(int hours)
setHours in class java.util.Date@Deprecated public void setMinutes(int minutes)
setMinutes in class java.util.Date@Deprecated public void setMonth(int month)
setMonth in class java.util.Date@Deprecated public void setSeconds(int seconds)
setSeconds in class java.util.Date@Deprecated public void setTime(long time)
setTime in class java.util.Date@Deprecated public void setYear(int year)
setYear in class java.util.Date