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)wherelongis milliseconds since midnightvalueOf(String)where theStringis in 'h.mma' formatvalueOf(Calendar, String)where theStringis in 'h.mma' formatvalueOf(Duration)whereDurationis time since midnightvalueOf(Time)whereTimeis some point in time todayvalueOf(Calendar, Time)whereTimeis some point in time todaymilitaryTime(int hour, int minute, int second)for 24-hour timetime(int hour, int minute, Meridian)whereMeridianis AM or PMtime(int hour, int minute, int second, Meridian)whereMeridianis 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
IllegalArgumentExceptionwill be thrown.Military hours, minutes and seconds of the time of day can be retrieved by calling the
hour,minute, andsecondmethods.The next occurrence of a given
TimeOfDaycan 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 classTimeOfDay.MeridianDeprecated.Typesafe AM/PM enumeration.
-
Field Summary
Fields Modifier and Type Field Description static TimeOfDay.MeridianAMDeprecated.Constant for AM time.static TimeOfDayMIDNIGHTDeprecated.Constant for midnight.static TimeOfDayNOONDeprecated.Constant for noon.static TimeOfDay.MeridianPMDeprecated.Constant for PM time.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanafter(org.apache.wicket.util.time.AbstractTimeValue that)Deprecated.Returnstrueif thisTimevalue is after the givenTimeargument's value.booleanbefore(org.apache.wicket.util.time.AbstractTimeValue that)Deprecated.Returnstrueif thisTimevalue is before the givenTimeargument's value.longgetMilliseconds()Deprecated.Retrieves the number of milliseconds in thisTimevalue.inthour()Deprecated.Retrieves the hour of the day.static TimeOfDaymilitaryTime(int hour, int minute, int second)Deprecated.Retrieves aTimeOfDayvalue on a 24-hour clock.intminute()Deprecated.Retrieves the minute.Timenext()Deprecated.Retrieves the next occurrence of thisTimeOfDayin local time.Timenext(Calendar calendar)Deprecated.Retrieves the next occurrence of thisTimeOfDayon the givenCalendar.static TimeOfDaynow()Deprecated.Retrieves theTimeOfDayrepresenting 'now'.static TimeOfDaynow(Calendar calendar)Deprecated.Retrieves theTimeOfDayrepresenting 'now' on the givenCalendar.intsecond()Deprecated.Retrieves the second.static TimeOfDaytime(int hour, int minute, int second, TimeOfDay.Meridian meridian)Deprecated.Retrieves aTimeOfDayon a 12-hour clock.static TimeOfDaytime(int hour, int minute, TimeOfDay.Meridian meridian)Deprecated.Retrieves aTimeOfDayon a 12-hour clock.StringtoString()Deprecated.Converts thisTimeto aStringsuitable for use in a file system name.StringtoTimeString()Deprecated.Converts thisTimeto a timeStringusing the formatter 'h.mma'.StringtoTimeString(Calendar calendar)Deprecated.Converts thisTimeto aDate Stringusing theDateformatter 'h.mma'.static TimeOfDayvalueOf(long time)Deprecated.Converts alongvalue to aTimeOfDayinstance.static TimeOfDayvalueOf(String time)Deprecated.Converts aStringvalue to aTimeOfDayinstance.static TimeOfDayvalueOf(Calendar calendar, String time)Deprecated.Converts a timeStringandCalendarto aTimeOfDayinstance.static TimeOfDayvalueOf(Calendar calendar, Time time)Deprecated.Converts aTimeinstance andCalendarto aTimeOfDayinstance.static TimeOfDayvalueOf(Duration duration)Deprecated.Converts aDurationinstance to aTimeOfDayinstance.static TimeOfDayvalueOf(Time time)Deprecated.Converts aStringvalue to aTimeOfDayinstance.-
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 aTimeOfDayvalue 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 theTimeOfDayrepresenting 'now'.- Returns:
- the time of day it is now
-
now
public static TimeOfDay now(Calendar calendar)
Deprecated.Retrieves theTimeOfDayrepresenting 'now' on the givenCalendar.- Parameters:
calendar- theCalendarto 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 aTimeOfDayon 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
TimeOfDayvalue
-
time
public static TimeOfDay time(int hour, int minute, TimeOfDay.Meridian meridian)
Deprecated.Retrieves aTimeOfDayon a 12-hour clock.- Parameters:
hour- the hour (1-12)minute- the minute (0-59)meridian- AM of PM- Returns:
- the
TimeOfDayvalue
-
valueOf
public static TimeOfDay valueOf(Calendar calendar, String time) throws ParseException
Deprecated.Converts a timeStringandCalendarto aTimeOfDayinstance.- Parameters:
calendar- theCalendarto use when parsing timeStringtime- aStringin 'h.mma' format- Returns:
- the
TimeOfDayon the givenCalendar - Throws:
ParseException
-
valueOf
public static TimeOfDay valueOf(Calendar calendar, Time time)
Deprecated.Converts aTimeinstance andCalendarto aTimeOfDayinstance.- Parameters:
calendar- theCalendarto usetime- aTimeinstance- Returns:
- the
TimeOfDayon the givenCalendar
-
valueOf
public static TimeOfDay valueOf(Duration duration)
Deprecated.Converts aDurationinstance to aTimeOfDayinstance.- Parameters:
duration- theDurationto use- Returns:
- the
TimeOfDayof the givenDuration
-
valueOf
public static TimeOfDay valueOf(long time)
Deprecated.Converts alongvalue to aTimeOfDayinstance.- Parameters:
time- the time in milliseconds today- Returns:
- the
TimeOfDay
-
valueOf
public static TimeOfDay valueOf(String time) throws ParseException
Deprecated.Converts aStringvalue to aTimeOfDayinstance.- Parameters:
time- aStringin 'h.mma' format- Returns:
- the
TimeOfDay - Throws:
ParseException
-
valueOf
public static TimeOfDay valueOf(Time time)
Deprecated.Converts aStringvalue to aTimeOfDayinstance.- Parameters:
time- aTimeto convert toTimeOfDay- Returns:
- the
TimeOfDayin 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 thisTimeOfDayin local time.- Returns:
- the next occurrence of this
TimeOfDayin local time
-
next
public Time next(Calendar calendar)
Deprecated.Retrieves the next occurrence of thisTimeOfDayon the givenCalendar.- Parameters:
calendar- theCalendarto use- Returns:
- the next occurrence of this
TimeOfDayon the givenCalendar
-
second
public int second()
Deprecated.Retrieves the second.- Returns:
- the second (0-59)
-
toString
public String toString()
Deprecated.Converts thisTimeto aStringsuitable for use in a file system name.- Returns:
- this
Timeas a formattedString - See Also:
Object.toString()
-
after
public final boolean after(org.apache.wicket.util.time.AbstractTimeValue that)
Deprecated.Returnstrueif thisTimevalue is after the givenTimeargument's value.- Parameters:
that- theAbstractTimeValueto compare with- Returns:
trueif thisTimevalue is afterthatTimevalue
-
before
public final boolean before(org.apache.wicket.util.time.AbstractTimeValue that)
Deprecated.Returnstrueif thisTimevalue is before the givenTimeargument's value.- Parameters:
that- theAbstractTimeValueto compare with- Returns:
trueif thisTimevalue is beforethatTimevalue
-
toTimeString
public final String toTimeString()
Deprecated.Converts thisTimeto a timeStringusing the formatter 'h.mma'.- Returns:
- the
TimeString
-
toTimeString
public final String toTimeString(Calendar calendar)
Deprecated.Converts thisTimeto aDate Stringusing theDateformatter 'h.mma'.- Parameters:
calendar- theCalendarto use in the conversion- Returns:
- the
DateString
-
getMilliseconds
public final long getMilliseconds()
Deprecated.Retrieves the number of milliseconds in thisTimevalue.- Returns:
- the number of milliseconds in this
Timevalue
-
-