Class DayOfWeekOccurrence

  • All Implemented Interfaces:
    Serializable

    @Embeddable
    public class DayOfWeekOccurrence
    extends Object
    implements Serializable
    The occurrence of a day of week represents the nth occurrence of a day of week in a month or in a year within a recurrence rule of a PlannableOnCalendar object. For example, the third tuesday in the month.
    See Also:
    Serialized Form
    • Field Detail

      • ALL_OCCURRENCES

        public static final int ALL_OCCURRENCES
        A constant that defines a specific value for all the occurrences of the represented day of week in a week, a month or a year.
        See Also:
        Constant Field Values
      • LAST_DAY

        public static final int LAST_DAY
        A constant that defines a specific value for the last day according to the recurrence rule. For example, for a monthly recurrence the last monday of each month.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DayOfWeekOccurrence

        protected DayOfWeekOccurrence()
    • Method Detail

      • nth

        public static DayOfWeekOccurrence nth​(int nth,
                                              DayOfWeek dayOfWeek)
        Creates an instance of DayOfWeekOccurrence representing the nth occurrence of the specified day of week in a month or in a year.
        Parameters:
        nth - a positive number indicating the nth occurrence of the specified day of week, id est the nth occurrence of the day of week encountered in the month or in the year.
        dayOfWeek - the day of week.
        Returns:
        a DayOfWeekOccurrence instance.
      • all

        public static DayOfWeekOccurrence all​(DayOfWeek dayOfWeek)
        Creates an instance of DayOfWeekOccurrence representing all the occurrences of the specified day of week in a week, in a month or in a year.
        Parameters:
        dayOfWeek - the day of week.
        Returns:
        a DayOfWeekOccurrence instance.
      • dayOfWeek

        public DayOfWeek dayOfWeek()
        Gets the day of week of this occurrence.
        Returns:
        the day of week.
      • nth

        public int nth()
        Gets the nth this occurrence is.
        Returns:
        the nth occurrence or ALL_OCCURRENCES if all of the underlying day of week are considered.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object