# Class RecurrenceRule

java.lang.Object
org.daypilot.recurrence.RecurrenceRule

public class RecurrenceRule extends Object

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `RecurrenceRule.RangeSpecType`
  Repeat range definition type (Until, or Times).

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final RecurrenceRule`
  `EXCEPTION`
  Specifies that this event represents an exception from rule defined in the main event.
  `static final RecurrenceRule`
  `NOREPEAT`
  Specifies that the event does not recur.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `RecurrenceRule`
  `annually()`
  Specifies that the event will repeat every year.
  `RecurrenceRule`
  `daily()`
  Specifies that the event will repeat daily.
  `RecurrenceRule`
  `daily(int every)`
  Specifies that the event will repeat every x days.
  `static RecurrenceRule`
  `decode(String input)`
  Loads a rule from a string encoded using Encode() method (DataRecurrenceField).
  `String`
  `encode()`
  Creates a string representation of the rule that can be stored in the database (DataRecurrenceField).
  `static String`
  `encodeExceptionDeleted(String masterId, DateTime start)`
  Creates a string representation of a 'Deleted' exception from the rule that can be stored in the database (DataRecurrenceField).
  `static String`
  `encodeExceptionModified(String masterId, DateTime start)`
  Creates a string representation of a 'Modified' exception from the rule that can be stored in the database (DataRecurrenceField).
  `static RecurrenceRule`
  `fromDateTime(String id, DateTime start)`
  Creates a new RecurrenceRule from starting DateTime.
  `static RecurrenceRule`
  `fromJson(String id, DateTime start, String json)`
  `int`
  `getEvery()`
  `String`
  `getId()`
  `List<Integer>`
  `getNamed()`
  `RecurrenceRule.RangeSpecType`
  `getRangeSpec()`
  `RepeatRule`
  `getRepeat()`
  `Integer`
  `getTimesValue()`
  `List<Integer>`
  `getUnits()`
  `DateTime`
  `getUntilValue()`
  `RecurrenceRule`
  `indefinitely()`
  The event will repeat indefinitely.
  `RecurrenceRule`
  `monthly()`
  Specifies that the event will repeat every month.
  `RecurrenceRule`
  `monthly(int[] days, int[] months)`
  Specifies that the event will repeat in certain months on certain days of month.
  `RecurrenceRule`
  `monthly(Integer[] days)`
  Specifies that the event will repeat every month on certain days of month.
  `RecurrenceRule`
  `monthly(Integer[] days, int every)`
  Specifies that the event will repeat every x month on certain days of month.
  `DateTime`
  `next(int count, DateTime last)`
  `List<Occurrence>`
  `occurrences(DateTime limit)`
  `void`
  `setEvery(int every)`
  `void`
  `setId(String value)`
  `void`
  `setNamed(List<Integer> named)`
  `void`
  `setRangeSpec(RecurrenceRule.RangeSpecType value)`
  `void`
  `setRepeat(RepeatRule repeat)`
  `void`
  `setUnits(List<Integer> units)`
  `RecurrenceRule`
  `times(int times)`
  How many times it will be repeated.
  `String`
  `ToJson()`
  Serializes the rule to a JSON string that can be used to fill the UI dialog (RecurrentEventEdit.aspx).
  `String`
  `ToJson(Locale locale)`
  Serializes the rule to a JSON string that can be used to fill the UI dialog (RecurrentEventEdit.aspx).
  `RecurrenceRule`
  `until(DateTime until)`
  What the ending date of the repeat range.
  `RecurrenceRule`
  `weekly()`
  Specifies that the event will repeat every week.
  `RecurrenceRule`
  `weekly(DayOfWeek[] days)`
  Specifies that the event will repeat on certain days every week.
  `RecurrenceRule`
  `weekly(DayOfWeek[] days, int every)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### NOREPEAT

    public static final RecurrenceRule NOREPEAT
    Specifies that the event does not recur.

  - ### EXCEPTION

    public static final RecurrenceRule EXCEPTION
    Specifies that this event represents an exception from rule defined in the main event.

- ## Method Details

  - ### getId

    public String getId()

  - ### setId

    public void setId(String value)

  - ### getRangeSpec

    public RecurrenceRule.RangeSpecType getRangeSpec()

  - ### setRangeSpec

    public void setRangeSpec(RecurrenceRule.RangeSpecType value)

  - ### getUntilValue

    public DateTime getUntilValue()

  - ### getTimesValue

    public Integer getTimesValue()

  - ### fromDateTime

    public static RecurrenceRule fromDateTime(String id, DateTime start)
    Creates a new RecurrenceRule from starting DateTime. It prefills certain fields but it's still necessary to specify it further by calling methods like Weekly().
    Event id. Starting DateTime.

  - ### monthly

    public RecurrenceRule monthly()
    Specifies that the event will repeat every month.

  - ### monthly

    public RecurrenceRule monthly(Integer[] days)
    Specifies that the event will repeat every month on certain days of month.

  - ### monthly

    public RecurrenceRule monthly(Integer[] days, int every)
    Specifies that the event will repeat every x month on certain days of month.

  - ### annually

    public RecurrenceRule annually()
    Specifies that the event will repeat every year.

  - ### monthly

    public RecurrenceRule monthly(int[] days, int[] months)
    Specifies that the event will repeat in certain months on certain days of month.

  - ### daily

    public RecurrenceRule daily()
    Specifies that the event will repeat daily.

  - ### daily

    public RecurrenceRule daily(int every)
    Specifies that the event will repeat every x days.

  - ### weekly

    public RecurrenceRule weekly()
    Specifies that the event will repeat every week.

  - ### weekly

    public RecurrenceRule weekly(DayOfWeek[] days)
    Specifies that the event will repeat on certain days every week.

  - ### weekly

    public RecurrenceRule weekly(DayOfWeek[] days, int every)

  - ### times

    public RecurrenceRule times(int times)
    How many times it will be repeated.

  - ### until

    public RecurrenceRule until(DateTime until)
    What the ending date of the repeat range.

  - ### indefinitely

    public RecurrenceRule indefinitely()
    The event will repeat indefinitely.

  - ### encode

    public String encode()
    Creates a string representation of the rule that can be stored in the database (DataRecurrenceField).

  - ### encodeExceptionModified

    public static String encodeExceptionModified(String masterId, DateTime start)
    Creates a string representation of a 'Modified' exception from the rule that can be stored in the database (DataRecurrenceField).

  - ### encodeExceptionDeleted

    public static String encodeExceptionDeleted(String masterId, DateTime start)
    Creates a string representation of a 'Deleted' exception from the rule that can be stored in the database (DataRecurrenceField).

  - ### decode

    public static RecurrenceRule decode(String input)
    Loads a rule from a string encoded using Encode() method (DataRecurrenceField).

  - ### ToJson

    public String ToJson()
    Serializes the rule to a JSON string that can be used to fill the UI dialog (RecurrentEventEdit.aspx). It is only able to serialize a subset of the possible rules that can be loaded by the dialog. It uses the culture of the current thread.

  - ### ToJson

    public String ToJson(Locale locale)
    Serializes the rule to a JSON string that can be used to fill the UI dialog (RecurrentEventEdit.aspx). It is only able to serialize a subset of the possible rules that can be loaded by the dialog.
    The culture used to format the DateTime values.

  - ### fromJson

    public static RecurrenceRule fromJson(String id, DateTime start, String json)

  - ### occurrences

    public List<Occurrence> occurrences(DateTime limit)

  - ### getRepeat

    public RepeatRule getRepeat()

  - ### setRepeat

    public void setRepeat(RepeatRule repeat)

  - ### getEvery

    public int getEvery()

  - ### setEvery

    public void setEvery(int every)

  - ### getNamed

    public List<Integer> getNamed()

  - ### setNamed

    public void setNamed(List<Integer> named)

  - ### getUnits

    public List<Integer> getUnits()

  - ### setUnits

    public void setUnits(List<Integer> units)

  - ### next

    public DateTime next(int count, DateTime last)