Class RecurrencePeriod

  • All Implemented Interfaces:
    Serializable

    @Embeddable
    public class RecurrencePeriod
    extends Object
    implements Serializable
    A period of a recurrence. It defines the recurrence of a PlannableOnCalendar object in a calendar as a regular interval in a given unit of time. For example, in every 2 weeks, week is the unit * of time whereas 2 is the interval in this unit of time. The unit of time of the recurrence period cannot be less that the day.
    See Also:
    Serialized Form
    • Constructor Detail

      • RecurrencePeriod

        protected RecurrencePeriod()
        Constructs an empty recurrence period for the persistence engine.
    • Method Detail

      • every

        public static RecurrencePeriod every​(int interval,
                                             TimeUnit unit)
        Creates a recurrence period from the specified frequency statement that is expressed by a regular interval in a given unit of time. For example, every 3 months.
        Parameters:
        interval - the regular interval of the period in the specified unit of time.
        unit - an unit of time. It doesn't must be lesser than the day, otherwise an IllegalArgumentException is thrown.
        Returns:
        a recurrence period matching specified the frequency statement.
      • getInterval

        public int getInterval()
        Gets the interval of this period.
        Returns:
        the period interval.
      • getUnit

        public TimeUnit getUnit()
        Gets the unit of time of the interval.
        Returns:
        the unit of time on which the period is defined.
      • isHourly

        public boolean isHourly()
        Is the frequency is hourly?
        Returns:
        true if the recurrence period is on a per-hours basis. False otherwise.
      • isDaily

        public boolean isDaily()
        Is the frequency is daily?
        Returns:
        true if the recurrence period is on a per-days basis. False otherwise.
      • isWeekly

        public boolean isWeekly()
        Is the frequency is weekly?
        Returns:
        true if the recurrence period is on a per-weeks basis. False otherwise.
      • isMonthly

        public boolean isMonthly()
        Is the frequency is monthly?
        Returns:
        true if the recurrence period is on a per-months basis. False otherwise.
      • isYearly

        public boolean isYearly()
        Is the frequency is yearly?
        Returns:
        true if the recurrence period is on a per-years basis. False otherwise.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object