|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jimmc.util.DateSpec
A representation of date or date/time information with specified precision. This can encode year/month/day/hour/minute/second/fractionalSecond, or any less precise subset. There are two primary differences between this and Date or Timestamp:
Field Summary | |
protected java.util.Date |
date
Our date. |
protected java.text.SimpleDateFormat |
dateFormat
The format for this instance. |
protected int |
precision
The precision of our date. |
static int |
PRECISION_DAY
Precision to the day. |
static int |
PRECISION_FRACTION
Precision to the fractional second. |
static int |
PRECISION_HOUR
Precision to the hour. |
static int |
PRECISION_MINUTE
Precision to the minute. |
static int |
PRECISION_MONTH
Precision to the month. |
static int |
PRECISION_NONE
No data specified. |
static int |
PRECISION_SECOND
Precision to the second. |
static int |
PRECISION_YEAR
Precision to the year. |
Constructor Summary | |
DateSpec()
Create a DateSpec with no data. |
|
DateSpec(java.util.Date date)
Create a DateSpec from a Date. |
|
DateSpec(java.util.Date date,
int precision)
Create a DateSpec from a Date and precision. |
|
DateSpec(java.lang.String s)
Create a DateSpec from a string. |
Method Summary | |
java.lang.Object |
clone()
|
int |
compareTo(java.lang.Object o)
|
java.util.Date |
getDate()
Get our date. |
protected static java.text.SimpleDateFormat |
getDateFormat(int precision)
Get our canonical date format according to the precision. |
int |
getPrecision()
Get our precision. |
protected void |
setDateFormat()
Set our canonical date format according to the precision. |
void |
setPrecision(int precision)
Set our precision. |
java.lang.String |
toString()
Convert to a String. |
static DateSpec |
valueOf(java.lang.String s)
Create a DateSpec from a string. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.util.Date date
protected int precision
public static final int PRECISION_NONE
public static final int PRECISION_YEAR
public static final int PRECISION_MONTH
public static final int PRECISION_DAY
public static final int PRECISION_HOUR
public static final int PRECISION_MINUTE
public static final int PRECISION_SECOND
public static final int PRECISION_FRACTION
protected java.text.SimpleDateFormat dateFormat
Constructor Detail |
public DateSpec()
public DateSpec(java.util.Date date, int precision)
public DateSpec(java.lang.String s)
public DateSpec(java.util.Date date)
Method Detail |
public java.util.Date getDate()
public void setPrecision(int precision)
public int getPrecision()
protected static java.text.SimpleDateFormat getDateFormat(int precision)
protected void setDateFormat()
public java.lang.String toString()
toString
in class java.lang.Object
public static DateSpec valueOf(java.lang.String s)
toString()
.public java.lang.Object clone()
clone
in class java.lang.Object
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |