Class 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 10
    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).

    Since:
    1.2.6
    Author:
    Jonathan Locke
    See Also:
    Serialized Form
    • Method Detail

      • militaryTime

        public static TimeOfDay militaryTime​(int hour,
                                             int minute,
                                             int second)
        Deprecated.
        Retrieves a TimeOfDay 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 the TimeOfDay representing 'now'.
        Returns:
        the time of day it is now
      • now

        public static TimeOfDay now​(Calendar calendar)
        Deprecated.
        Retrieves the TimeOfDay representing 'now' on the given Calendar.
        Parameters:
        calendar - the Calendar 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 a TimeOfDay 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 a TimeOfDay 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 time String and Calendar to a TimeOfDay instance.
        Parameters:
        calendar - the Calendar to use when parsing time String
        time - a String in 'h.mma' format
        Returns:
        the TimeOfDay on the given Calendar
        Throws:
        ParseException
      • valueOf

        public static TimeOfDay valueOf​(Calendar calendar,
                                        Time time)
        Deprecated.
        Converts a Time instance and Calendar to a TimeOfDay instance.
        Parameters:
        calendar - the Calendar to use
        time - a Time instance
        Returns:
        the TimeOfDay on the given Calendar
      • valueOf

        public static TimeOfDay valueOf​(Duration duration)
        Deprecated.
        Converts a Duration instance to a TimeOfDay instance.
        Parameters:
        duration - the Duration to use
        Returns:
        the TimeOfDay of the given Duration
      • valueOf

        public static TimeOfDay valueOf​(long time)
        Deprecated.
        Converts a long value to a TimeOfDay instance.
        Parameters:
        time - the time in milliseconds today
        Returns:
        the TimeOfDay
      • valueOf

        public static TimeOfDay valueOf​(Time time)
        Deprecated.
        Converts a String value to a TimeOfDay instance.
        Parameters:
        time - a Time to convert to TimeOfDay
        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 this TimeOfDay 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 this TimeOfDay on the given Calendar.
        Parameters:
        calendar - the Calendar to use
        Returns:
        the next occurrence of this TimeOfDay on the given Calendar
      • second

        public int second()
        Deprecated.
        Retrieves the second.
        Returns:
        the second (0-59)
      • toString

        public String toString()
        Deprecated.
        Converts this Time to a String suitable for use in a file system name.
        Returns:
        this Time as a formatted String
        See Also:
        Object.toString()
      • after

        public final boolean after​(org.apache.wicket.util.time.AbstractTimeValue that)
        Deprecated.
        Returns true if this Time value is after the given Time argument's value.
        Parameters:
        that - the AbstractTimeValue to compare with
        Returns:
        true if this Time value is after that Time value
      • before

        public final boolean before​(org.apache.wicket.util.time.AbstractTimeValue that)
        Deprecated.
        Returns true if this Time value is before the given Time argument's value.
        Parameters:
        that - the AbstractTimeValue to compare with
        Returns:
        true if this Time value is before that Time value
      • toTimeString

        public final String toTimeString()
        Deprecated.
        Converts this Time to a time String using the formatter 'h.mma'.
        Returns:
        the Time String
      • toTimeString

        public final String toTimeString​(Calendar calendar)
        Deprecated.
        Converts this Time to a Date String using the Date formatter 'h.mma'.
        Parameters:
        calendar - the Calendar to use in the conversion
        Returns:
        the Date String
      • getMilliseconds

        public final long getMilliseconds()
        Deprecated.
        Retrieves the number of milliseconds in this Time value.
        Returns:
        the number of milliseconds in this Time value