|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectjava.util.Date
org.mmbase.util.DynamicDate
public class DynamicDate
A DynamicDate is a Date object that has no fixed value, like 'now'. It is unmodifiable, so all
set-methods throw exceptions. There is no public constructor, but a public static getInstance(java.lang.String).
Sadly, the Date object of Sun is implemented using private static methods which use private
fields of the Date object, so not everything could be overridden perfectly. So, if e.g. a dynamic
date could be an argument of an 'after' or 'before' method, it is better to wrap it with eval(java.lang.String) first.
Basicly the following dynamic dates are possible:
getDemo() returns a list of several strings which can be parsed.
| Field Summary | |
|---|---|
protected String |
date
The original string by which this instance was gotten. |
| Constructor Summary | |
|---|---|
protected |
DynamicDate(String d)
|
| Method Summary | |
|---|---|
boolean |
after(Date when)
|
boolean |
before(Date when)
|
Object |
clone()
|
int |
compareTo(Date anotherDate)
|
boolean |
equals(Object obj)
|
static Date |
eval(Date date)
Makes sure the argument 'date' is no DynamicDate any more. |
static Date |
eval(String format)
This calls getInstance(java.lang.String), then eval(java.lang.String) and catches the parse-exception (in which
case it will return -1). |
protected Date |
evalDate()
This produces a normal Date object, and is called everytime when that is needed. |
int |
getDate()
Deprecated. |
int |
getDay()
Deprecated. |
static String[] |
getDemo()
Returns an arrays of example Strings that can be parsed by DynamicDate. |
String |
getFormat()
|
int |
getHours()
Deprecated. |
static Date |
getInstance(String format)
Parses a format string and returns Date instance, possibly a 'dynamic one'. |
int |
getMinutes()
Deprecated. |
int |
getMonth()
Deprecated. |
int |
getSeconds()
Deprecated. |
long |
getTime()
|
int |
getTimezoneOffset()
Deprecated. |
int |
getYear()
Deprecated. |
int |
hashCode()
|
static void |
main(String[] argv)
|
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 |
toGMTString()
Deprecated. |
String |
toLocaleString()
Deprecated. |
String |
toString()
|
| Methods inherited from class java.util.Date |
|---|
parse, UTC |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final String date
| Constructor Detail |
|---|
protected DynamicDate(String d)
| Method Detail |
|---|
public static Date getInstance(String format)
throws ParseException
ParseExceptionpublic static Date eval(String format)
getInstance(java.lang.String), then eval(java.lang.String) and catches the parse-exception (in which
case it will return -1).
This boils down to that this is a utility method to get a new Date object by String in just
one call.
public static Date eval(Date date)
public String getFormat()
protected Date evalDate()
eval(Date), which
will work on a normal Date object too.
public boolean after(Date when)
after in class Datepublic boolean before(Date when)
before in class Datepublic Object clone()
clone in class Datepublic int compareTo(Date anotherDate)
compareTo in interface Comparable<Date>compareTo in class Datepublic boolean equals(Object obj)
equals in class Date@Deprecated public int getDate()
getDate in class Date@Deprecated public int getDay()
getDay in class Date@Deprecated public int getHours()
getHours in class Date@Deprecated public int getMinutes()
getMinutes in class Date@Deprecated public int getMonth()
getMonth in class Date@Deprecated public int getSeconds()
getSeconds in class Datepublic long getTime()
getTime in class Date@Deprecated public int getTimezoneOffset()
getTimezoneOffset in class Date@Deprecated public int getYear()
getYear in class Datepublic int hashCode()
hashCode in class Date@Deprecated public void setDate(int date)
setDate in class Date@Deprecated public void setHours(int hours)
setHours in class Date@Deprecated public void setMinutes(int minutes)
setMinutes in class Date@Deprecated public void setMonth(int month)
setMonth in class Date@Deprecated public void setSeconds(int seconds)
setSeconds in class Date@Deprecated public void setTime(long time)
setTime in class Date@Deprecated public void setYear(int year)
setYear in class Date@Deprecated public String toGMTString()
toGMTString in class Date@Deprecated public String toLocaleString()
toLocaleString in class Datepublic String toString()
toString in class Datepublic static String[] getDemo()
public static void main(String[] argv)
throws ParseException,
ParseException
ParseException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||