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 String |
LAZY_NOW_LABEL |
| Constructor and Description |
|---|
RelativeIso8601Date(Date date) |
RelativeIso8601Date(String dateStr) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
after(Date when) |
boolean |
before(Date when) |
Object |
clone() |
int |
compareTo(Date anotherDate) |
boolean |
equals(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.
|
String |
toString()
Returns a
String representation of this date. |
from, parse, toGMTString, toInstant, toLocaleString, UTCpublic static final String LAZY_NOW_LABEL
public RelativeIso8601Date(Date date)
public RelativeIso8601Date(String dateStr)
public static RelativeIso8601Date generateLazyNowInstance()
public 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 int compareTo(Date anotherDate)
compareTo in interface Comparable<Date>compareTo in class Date@Deprecated public int getDate()
@Deprecated public int getDay()
@Deprecated public int getHours()
@Deprecated public int getMinutes()
getMinutes in class Date@Deprecated public int getMonth()
@Deprecated public int getSeconds()
getSeconds in class Date@Deprecated public int getTimezoneOffset()
getTimezoneOffset in class Date@Deprecated public int getYear()
@Deprecated public void setDate(int date)
@Deprecated public void setHours(int hours)
@Deprecated public void setMinutes(int minutes)
setMinutes in class Date@Deprecated public void setMonth(int month)
@Deprecated public void setSeconds(int seconds)
setSeconds in class Date@Deprecated public void setTime(long time)
@Deprecated public void setYear(int year)