Package org.apache.wicket.util.time
Class TimeOfDay
- java.lang.Object
-
- org.apache.wicket.util.value.LongValue
-
- org.apache.wicket.util.time.TimeOfDay
-
- All Implemented Interfaces:
Serializable
,Comparable<LongValue>
@Deprecated public final class TimeOfDay extends LongValue
Deprecated.Since Wicket 9 this class is obsolete and no more used. It will be removed in Wicket 10An immutable time of day value represented as milliseconds since the most recent midnight.Values can be constructed using various factory methods:
valueOf(long)
wherelong
is milliseconds since midnightvalueOf(String)
where theString
is in 'h.mma' formatvalueOf(Calendar, String)
where theString
is in 'h.mma' formatvalueOf(Duration)
whereDuration
is time since midnightvalueOf(Time)
whereTime
is some point in time todayvalueOf(Calendar, Time)
whereTime
is some point in time todaymilitaryTime(int hour, int minute, int second)
for 24-hour timetime(int hour, int minute, Meridian)
whereMeridian
is AM or PMtime(int hour, int minute, int second, Meridian)
whereMeridian
is AM or PMnow()
to construct the current time of daynow(Calendar)
to construct the current time of day using a givenCalendar
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
, andsecond
methods.The next occurrence of a given
TimeOfDay
can be retrieved by callingnext()
ornext(Calendar)
.- Since:
- 1.2.6
- Author:
- Jonathan Locke
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TimeOfDay.Meridian
Deprecated.Typesafe AM/PM enumeration.
-
Field Summary
Fields Modifier and Type Field Description static TimeOfDay.Meridian
AM
Deprecated.Constant for AM time.static TimeOfDay
MIDNIGHT
Deprecated.Constant for midnight.static TimeOfDay
NOON
Deprecated.Constant for noon.static TimeOfDay.Meridian
PM
Deprecated.Constant for PM time.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
after(org.apache.wicket.util.time.AbstractTimeValue that)
Deprecated.Returnstrue
if thisTime
value is after the givenTime
argument's value.boolean
before(org.apache.wicket.util.time.AbstractTimeValue that)
Deprecated.Returnstrue
if thisTime
value is before the givenTime
argument's value.long
getMilliseconds()
Deprecated.Retrieves the number of milliseconds in thisTime
value.int
hour()
Deprecated.Retrieves the hour of the day.static TimeOfDay
militaryTime(int hour, int minute, int second)
Deprecated.Retrieves aTimeOfDay
value on a 24-hour clock.int
minute()
Deprecated.Retrieves the minute.Time
next()
Deprecated.Retrieves the next occurrence of thisTimeOfDay
in local time.Time
next(Calendar calendar)
Deprecated.Retrieves the next occurrence of thisTimeOfDay
on the givenCalendar
.static TimeOfDay
now()
Deprecated.Retrieves theTimeOfDay
representing 'now'.static TimeOfDay
now(Calendar calendar)
Deprecated.Retrieves theTimeOfDay
representing 'now' on the givenCalendar
.int
second()
Deprecated.Retrieves the second.static TimeOfDay
time(int hour, int minute, int second, TimeOfDay.Meridian meridian)
Deprecated.Retrieves aTimeOfDay
on a 12-hour clock.static TimeOfDay
time(int hour, int minute, TimeOfDay.Meridian meridian)
Deprecated.Retrieves aTimeOfDay
on a 12-hour clock.String
toString()
Deprecated.Converts thisTime
to aString
suitable for use in a file system name.String
toTimeString()
Deprecated.Converts thisTime
to a timeString
using the formatter 'h.mma'.String
toTimeString(Calendar calendar)
Deprecated.Converts thisTime
to aDate String
using theDate
formatter 'h.mma'.static TimeOfDay
valueOf(long time)
Deprecated.Converts along
value to aTimeOfDay
instance.static TimeOfDay
valueOf(String time)
Deprecated.Converts aString
value to aTimeOfDay
instance.static TimeOfDay
valueOf(Calendar calendar, String time)
Deprecated.Converts a timeString
andCalendar
to aTimeOfDay
instance.static TimeOfDay
valueOf(Calendar calendar, Time time)
Deprecated.Converts aTime
instance andCalendar
to aTimeOfDay
instance.static TimeOfDay
valueOf(Duration duration)
Deprecated.Converts aDuration
instance to aTimeOfDay
instance.static TimeOfDay
valueOf(Time time)
Deprecated.Converts aString
value to aTimeOfDay
instance.-
Methods inherited from class org.apache.wicket.util.value.LongValue
compareTo, equals, greaterThan, greaterThan, greaterThanOrEqual, greaterThanOrEqual, hashCode, lessThan, lessThan, lessThanOrEqual, lessThanOrEqual, max, maxNullSafe, min
-
-
-
-
Field Detail
-
AM
public static final TimeOfDay.Meridian AM
Deprecated.Constant for AM time.
-
PM
public static final TimeOfDay.Meridian PM
Deprecated.Constant for PM time.
-
-
Method Detail
-
militaryTime
public static TimeOfDay militaryTime(int hour, int minute, int second)
Deprecated.Retrieves aTimeOfDay
value on a 24-hour clock.- Parameters:
hour
- the hour (0-23)minute
- the minute (0-59)second
- the second (0-59)- Returns:
- the time of day
-
now
public static TimeOfDay now()
Deprecated.Retrieves theTimeOfDay
representing 'now'.- Returns:
- the time of day it is now
-
now
public static TimeOfDay now(Calendar calendar)
Deprecated.Retrieves theTimeOfDay
representing 'now' on the givenCalendar
.- Parameters:
calendar
- theCalendar
to use- Returns:
- the time of day it is now on the given
Calendar
-
time
public static TimeOfDay time(int hour, int minute, int second, TimeOfDay.Meridian meridian)
Deprecated.Retrieves aTimeOfDay
on a 12-hour clock.- Parameters:
hour
- the hour (1-12)minute
- the minute (0-59)second
- the second (0-59)meridian
- AM or PM- Returns:
- the
TimeOfDay
value
-
time
public static TimeOfDay time(int hour, int minute, TimeOfDay.Meridian meridian)
Deprecated.Retrieves aTimeOfDay
on a 12-hour clock.- Parameters:
hour
- the hour (1-12)minute
- the minute (0-59)meridian
- AM of PM- Returns:
- the
TimeOfDay
value
-
valueOf
public static TimeOfDay valueOf(Calendar calendar, String time) throws ParseException
Deprecated.Converts a timeString
andCalendar
to aTimeOfDay
instance.- Parameters:
calendar
- theCalendar
to use when parsing timeString
time
- aString
in 'h.mma' format- Returns:
- the
TimeOfDay
on the givenCalendar
- Throws:
ParseException
-
valueOf
public static TimeOfDay valueOf(Calendar calendar, Time time)
Deprecated.Converts aTime
instance andCalendar
to aTimeOfDay
instance.- Parameters:
calendar
- theCalendar
to usetime
- aTime
instance- Returns:
- the
TimeOfDay
on the givenCalendar
-
valueOf
public static TimeOfDay valueOf(Duration duration)
Deprecated.Converts aDuration
instance to aTimeOfDay
instance.- Parameters:
duration
- theDuration
to use- Returns:
- the
TimeOfDay
of the givenDuration
-
valueOf
public static TimeOfDay valueOf(long time)
Deprecated.Converts along
value to aTimeOfDay
instance.- Parameters:
time
- the time in milliseconds today- Returns:
- the
TimeOfDay
-
valueOf
public static TimeOfDay valueOf(String time) throws ParseException
Deprecated.Converts aString
value to aTimeOfDay
instance.- Parameters:
time
- aString
in 'h.mma' format- Returns:
- the
TimeOfDay
- Throws:
ParseException
-
valueOf
public static TimeOfDay valueOf(Time time)
Deprecated.Converts aString
value to aTimeOfDay
instance.- Parameters:
time
- aTime
to convert toTimeOfDay
- Returns:
- the
TimeOfDay
in the current time zone
-
hour
public int hour()
Deprecated.Retrieves the hour of the day.- Returns:
- the hour (0-23) of this
TimeOfDay
-
minute
public int minute()
Deprecated.Retrieves the minute.- Returns:
- the minute (0-59) of this
TimeOfDay
-
next
public Time next()
Deprecated.Retrieves the next occurrence of thisTimeOfDay
in local time.- Returns:
- the next occurrence of this
TimeOfDay
in local time
-
next
public Time next(Calendar calendar)
Deprecated.Retrieves the next occurrence of thisTimeOfDay
on the givenCalendar
.- Parameters:
calendar
- theCalendar
to use- Returns:
- the next occurrence of this
TimeOfDay
on the givenCalendar
-
second
public int second()
Deprecated.Retrieves the second.- Returns:
- the second (0-59)
-
toString
public String toString()
Deprecated.Converts thisTime
to aString
suitable for use in a file system name.- Returns:
- this
Time
as a formattedString
- See Also:
Object.toString()
-
after
public final boolean after(org.apache.wicket.util.time.AbstractTimeValue that)
Deprecated.Returnstrue
if thisTime
value is after the givenTime
argument's value.- Parameters:
that
- theAbstractTimeValue
to compare with- Returns:
true
if thisTime
value is afterthat
Time
value
-
before
public final boolean before(org.apache.wicket.util.time.AbstractTimeValue that)
Deprecated.Returnstrue
if thisTime
value is before the givenTime
argument's value.- Parameters:
that
- theAbstractTimeValue
to compare with- Returns:
true
if thisTime
value is beforethat
Time
value
-
toTimeString
public final String toTimeString()
Deprecated.Converts thisTime
to a timeString
using the formatter 'h.mma'.- Returns:
- the
Time
String
-
toTimeString
public final String toTimeString(Calendar calendar)
Deprecated.Converts thisTime
to aDate String
using theDate
formatter 'h.mma'.- Parameters:
calendar
- theCalendar
to use in the conversion- Returns:
- the
Date
String
-
getMilliseconds
public final long getMilliseconds()
Deprecated.Retrieves the number of milliseconds in thisTime
value.- Returns:
- the number of milliseconds in this
Time
value
-
-