|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.wicket.util.value.LongValue
org.apache.wicket.util.time.TimeOfDay
public final class TimeOfDay
An immutable time of day value represented as milliseconds since the most recent midnight.
Values can be constructed using various factory methods:
valueOf(long) where long is milliseconds since midnight
valueOf(String) where the String is in 'h.mma' format
valueOf(Calendar, String) where the String is in 'h.mma' format
valueOf(Duration) where Duration is time since midnight
valueOf(Time) where Time is some point in time today
valueOf(Calendar, Time) where Time is some point in time today
militaryTime(int hour, int minute, int second) for 24-hour time
time(int hour, int minute, Meridian) where Meridian is AM or PM
time(int hour, int minute, int second, Meridian) where Meridian is
AM or PM
now() to construct the current time of day
now(Calendar) to construct the current time of day using a given
Calendar
If an attempt is made to construct an illegal time of day value (one that is greater than 24
hours worth of milliseconds), an IllegalArgumentException will be thrown.
Military hours, minutes and seconds of the time of day can be retrieved by calling the
hour, minute, and second methods.
The next occurrence of a given TimeOfDay can be retrieved by calling
next() or next(Calendar).
| Nested Class Summary | |
|---|---|
static class |
TimeOfDay.Meridian
Typesafe AM/PM enumeration. |
| Field Summary | |
|---|---|
static TimeOfDay.Meridian |
AM
Constant for AM time. |
static TimeOfDay |
MIDNIGHT
Constant for midnight. |
static TimeOfDay |
NOON
Constant for noon. |
static TimeOfDay.Meridian |
PM
Constant for PM time. |
| Fields inherited from class org.apache.wicket.util.value.LongValue |
|---|
value |
| Method Summary | |
|---|---|
boolean |
after(org.apache.wicket.util.time.AbstractTimeValue that)
Returns true if this Time value is after the given
Time argument's value. |
boolean |
before(org.apache.wicket.util.time.AbstractTimeValue that)
Returns true if this Time value is before the given
Time argument's value. |
long |
getMilliseconds()
Retrieves the number of milliseconds in this Time value. |
int |
hour()
Retrieves the hour of the day. |
static TimeOfDay |
militaryTime(int hour,
int minute,
int second)
Retrieves a TimeOfDay value on a 24-hour clock. |
int |
minute()
Retrieves the minute. |
Time |
next()
Retrieves the next occurrence of this TimeOfDay in local time. |
Time |
next(Calendar calendar)
Retrieves the next occurrence of this TimeOfDay on the given
Calendar. |
static TimeOfDay |
now()
Retrieves the TimeOfDay representing 'now'. |
static TimeOfDay |
now(Calendar calendar)
Retrieves the TimeOfDay representing 'now' on the given Calendar. |
int |
second()
Retrieves the second. |
static TimeOfDay |
time(int hour,
int minute,
int second,
TimeOfDay.Meridian meridian)
Retrieves a TimeOfDay on a 12-hour clock. |
static TimeOfDay |
time(int hour,
int minute,
TimeOfDay.Meridian meridian)
Retrieves a TimeOfDay on a 12-hour clock. |
String |
toString()
Converts this Time to a String suitable for use in a file system
name. |
String |
toTimeString()
Converts this Time to a time String using the formatter 'h.mma'. |
String |
toTimeString(Calendar calendar)
Converts this Time to a Date String using the Date
formatter 'h.mma'. |
static TimeOfDay |
valueOf(Calendar calendar,
String time)
Converts a time String and Calendar to a TimeOfDay
instance. |
static TimeOfDay |
valueOf(Calendar calendar,
Time time)
Converts a Time instance and Calendar to a TimeOfDay
instance. |
static TimeOfDay |
valueOf(Duration duration)
Converts a Duration instance to a TimeOfDay instance. |
static TimeOfDay |
valueOf(long time)
Converts a long value to a TimeOfDay instance. |
static TimeOfDay |
valueOf(String time)
Converts a String value to a TimeOfDay instance. |
static TimeOfDay |
valueOf(Time time)
Converts a String value to a TimeOfDay instance. |
| Methods inherited from class org.apache.wicket.util.value.LongValue |
|---|
compareTo, equals, greaterThan, greaterThan, greaterThanOrEqual, greaterThanOrEqual, hashCode, lessThan, lessThan, lessThanOrEqual, lessThanOrEqual, max, maxNullSafe |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final TimeOfDay.Meridian AM
public static final TimeOfDay MIDNIGHT
public static final TimeOfDay.Meridian PM
public static final TimeOfDay NOON
| Method Detail |
|---|
public static TimeOfDay militaryTime(int hour,
int minute,
int second)
TimeOfDay value on a 24-hour clock.
hour - the hour (0-23)minute - the minute (0-59)second - the second (0-59)
public static TimeOfDay now()
TimeOfDay representing 'now'.
public static TimeOfDay now(Calendar calendar)
TimeOfDay representing 'now' on the given Calendar.
calendar - the Calendar to use
Calendar
public static TimeOfDay time(int hour,
int minute,
int second,
TimeOfDay.Meridian meridian)
TimeOfDay on a 12-hour clock.
hour - the hour (1-12)minute - the minute (0-59)second - the second (0-59)meridian - AM or PM
TimeOfDay value
public static TimeOfDay time(int hour,
int minute,
TimeOfDay.Meridian meridian)
TimeOfDay on a 12-hour clock.
hour - the hour (1-12)minute - the minute (0-59)meridian - AM of PM
TimeOfDay value
public static TimeOfDay valueOf(Calendar calendar,
String time)
throws ParseException
String and Calendar to a TimeOfDay
instance.
calendar - the Calendar to use when parsing time Stringtime - a String in 'h.mma' format
TimeOfDay on the given Calendar
ParseException
public static TimeOfDay valueOf(Calendar calendar,
Time time)
Time instance and Calendar to a TimeOfDay
instance.
calendar - the Calendar to usetime - a Time instance
TimeOfDay on the given Calendarpublic static TimeOfDay valueOf(Duration duration)
Duration instance to a TimeOfDay instance.
duration - the Duration to use
TimeOfDay of the given Durationpublic static TimeOfDay valueOf(long time)
long value to a TimeOfDay instance.
time - the time in milliseconds today
TimeOfDay
public static TimeOfDay valueOf(String time)
throws ParseException
String value to a TimeOfDay instance.
time - a String in 'h.mma' format
TimeOfDay
ParseExceptionpublic static TimeOfDay valueOf(Time time)
String value to a TimeOfDay instance.
time - a Time to convert to TimeOfDay
TimeOfDay in the current time zonepublic int hour()
TimeOfDaypublic int minute()
TimeOfDaypublic Time next()
TimeOfDay in local time.
TimeOfDay in local timepublic Time next(Calendar calendar)
TimeOfDay on the given
Calendar.
calendar - the Calendar to use
TimeOfDay on the given Calendarpublic int second()
public String toString()
Time to a String suitable for use in a file system
name.
Time as a formatted StringObject.toString()public final boolean after(org.apache.wicket.util.time.AbstractTimeValue that)
true if this Time value is after the given
Time argument's value.
that - the AbstractTimeValue to compare with
true if this Time value is after that
Time valuepublic final boolean before(org.apache.wicket.util.time.AbstractTimeValue that)
true if this Time value is before the given
Time argument's value.
that - the AbstractTimeValue to compare with
true if this Time value is before that
Time valuepublic final String toTimeString()
Time to a time String using the formatter 'h.mma'.
Time Stringpublic final String toTimeString(Calendar calendar)
Time to a Date String using the Date
formatter 'h.mma'.
calendar - the Calendar to use in the conversion
Date Stringpublic final long getMilliseconds()
Time value.
Time value
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||