|
Joda Time API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--org.joda.time.TimePeriod
TimePeriod is the standard implementation of an immutable time period class. It stores the period by the start date (when used) as a ReadableInstant object and the period length as milliseconds.
| Constructor Summary | |
TimePeriod(long period)
Creates new TimePeriod. |
|
TimePeriod(ReadableInstant start,
ReadableInstant end)
Creates new TimePeriod This TimePeriod will have a defined start date and a defined end date. |
|
TimePeriod(ReadableInstant start,
ReadableTimePeriod dur)
Creates new TimePeriod. |
|
TimePeriod(ReadableTimePeriod dur,
ReadableInstant end)
Creates new TimePeriod. |
|
TimePeriod(java.lang.String period)
Creates new TimePeriod. |
|
| Method Summary | |
java.lang.Object |
clone()
Public clone |
int |
compareTo(java.lang.Object obj)
Compare for natural order. |
boolean |
equals(java.lang.Object obj)
Compare for equality. |
java.lang.String |
format(java.text.Format formatter)
Format this object using a formatter object. |
int |
getDays()
Get the days field of the time period |
Instant |
getEndInstant()
Gets the end of this time period as an Instant. |
int |
getHours()
Get the hours field of the time period |
long |
getMillis()
Gets the length of this time period in milliseconds. |
int |
getMinutes()
Get the minutes field of the time period |
int |
getMonths()
Get the months field of the time period |
int |
getSeconds()
Get the seconds field of the time period |
Instant |
getStartInstant()
Gets the start of this time period as an Instant. |
protected long |
getTimePeriodMillisFromObject(java.lang.Object object)
Convert an object into a time period. |
int |
getTotalDays()
Get the total days field of the time period |
int |
getTotalHours()
Get the total hours field of the time period |
int |
getTotalMinutes()
Get the total minutes field of the time period |
int |
getTotalMonths()
Get the total months field of the time period |
int |
getTotalSeconds()
Get the total seconds field of the time period |
int |
getTotalWeeks()
Get the total weeks field of the time period |
int |
getYears()
Get the years field of the time period |
int |
hashCode()
Hashcode compatable with equals method. |
boolean |
isLongerThan(java.lang.Object obj)
Is this period longer than the specified period. |
boolean |
isShorterThan(java.lang.Object obj)
Is this period shorter than the specified period. |
java.lang.String |
toString()
Output a string in ISO8601 time period format. |
TimePeriod |
toTimePeriod()
Get the object as a TimePeriod |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public TimePeriod(long period)
period - the length of the period in milliseconds.
public TimePeriod(ReadableInstant start,
ReadableInstant end)
start - the Start date of this time periodend - the End date of this time period
public TimePeriod(ReadableInstant start,
ReadableTimePeriod dur)
start - the Start date of the time perioddur - the duration of the time period
public TimePeriod(ReadableTimePeriod dur,
ReadableInstant end)
dur - the duration of the time periodend - the end of the time period
public TimePeriod(java.lang.String period)
throws java.text.ParseException
period - an ISO time period string| Method Detail |
public java.lang.Object clone()
clone in class java.lang.Objectprotected long getTimePeriodMillisFromObject(java.lang.Object object)
object - ReadableTimePeriod, Long or String
java.lang.IllegalArgumentException - if the object is null, or the string invalid
java.lang.ClassCastException - if the object type is not supportedpublic java.lang.String format(java.text.Format formatter)
public long getMillis()
ReadableTimePeriod
getMillis in interface ReadableTimePeriodReadableTimePeriod.getMillis()public Instant getStartInstant()
ReadableTimePeriod
getStartInstant in interface ReadableTimePeriodReadableTimePeriod.getStartInstant()public Instant getEndInstant()
ReadableTimePeriod
getEndInstant in interface ReadableTimePeriodReadableTimePeriod.getEndInstant()public TimePeriod toTimePeriod()
toTimePeriod in interface ReadableTimePeriodpublic int getTotalSeconds()
public int getTotalMinutes()
public int getTotalHours()
public int getTotalDays()
public int getTotalMonths()
public int getTotalWeeks()
public int getSeconds()
public int getMinutes()
public int getHours()
public int getDays()
public int getMonths()
public int getYears()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic int compareTo(java.lang.Object obj)
compareTo in interface java.lang.Comparableobj - the object to compare to
java.lang.IllegalArgumentException - if the object is null, or the string invalid
java.lang.ClassCastException - if the object type is not supportedpublic boolean isLongerThan(java.lang.Object obj)
isLongerThan in interface ReadableTimePeriodobj - the period to compare to
java.lang.IllegalArgumentException - if the object is null, or the string invalid
java.lang.ClassCastException - if the object type is not supportedpublic boolean isShorterThan(java.lang.Object obj)
isShorterThan in interface ReadableTimePeriodobj - the period to compare to
java.lang.IllegalArgumentException - if the object is null, or the string invalid
java.lang.ClassCastException - if the object type is not supportedpublic java.lang.String toString()
toString in class java.lang.Object
|
Joda Time API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||