Package org.silverpeas.core.calendar
Class RecurrencePeriod
- java.lang.Object
-
- org.silverpeas.core.calendar.RecurrencePeriod
-
- All Implemented Interfaces:
Serializable
@Embeddable public class RecurrencePeriod extends Object implements Serializable
A period of a recurrence. It defines the recurrence of aPlannableOnCalendar
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 Summary
Constructors Modifier Constructor Description protected
RecurrencePeriod()
Constructs an empty recurrence period for the persistence engine.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
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.int
getInterval()
Gets the interval of this period.TimeUnit
getUnit()
Gets the unit of time of the interval.int
hashCode()
boolean
isDaily()
Is the frequency is daily?boolean
isHourly()
Is the frequency is hourly?boolean
isMonthly()
Is the frequency is monthly?boolean
isWeekly()
Is the frequency is weekly?boolean
isYearly()
Is the frequency is yearly?
-
-
-
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 anIllegalArgumentException
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.
-
-