biweekly.util
Class Recurrence.Builder

java.lang.Object
  extended by biweekly.util.Recurrence.Builder
Enclosing class:
Recurrence

public static class Recurrence.Builder
extends Object

Constructs Recurrence objects.

Author:
Michael Angstadt

Constructor Summary
Recurrence.Builder(Recurrence.Frequency frequency)
          Constructs a new builder.
Recurrence.Builder(Recurrence recur)
          Constructs a new builder
 
Method Summary
 Recurrence build()
          Builds the final Recurrence object.
 Recurrence.Builder byDay(Integer prefix, Recurrence.DayOfWeek byDay)
          Adds a BYDAY rule part.
 Recurrence.Builder byDay(Recurrence.DayOfWeek byDay)
          Adds a BYDAY rule part.
 Recurrence.Builder byHour(Integer byHour)
          Adds a BYHOUR rule part.
 Recurrence.Builder byMinute(Integer byMinute)
          Adds a BYMINUTE rule part.
 Recurrence.Builder byMonth(Integer byMonth)
          Adds a BYMONTH rule part.
 Recurrence.Builder byMonthDay(Integer byMonthDay)
          Adds a BYMONTHDAY rule part.
 Recurrence.Builder bySecond(Integer bySecond)
          Adds a BYSECOND rule part.
 Recurrence.Builder bySetPos(Integer bySetPos)
          Adds a BYSETPOS rule part.
 Recurrence.Builder byWeekNo(Integer byWeekNo)
          Adds a BYWEEKNO rule part.
 Recurrence.Builder byYearDay(Integer byYearDay)
          Adds a BYYEARDAY rule part.
 Recurrence.Builder count(Integer count)
          Gets the number of times the rule will be repeated.
 Recurrence.Builder frequency(Recurrence.Frequency frequency)
          Sets the frequency
 Recurrence.Builder interval(Integer interval)
          Gets how often the rule repeats, in relation to the frequency.
 Recurrence.Builder until(Date until)
          Sets the date that the recurrence stops.
 Recurrence.Builder until(Date until, boolean hasTime)
          Sets the date that the recurrence stops.
 Recurrence.Builder workweekStarts(Recurrence.DayOfWeek workweekStarts)
          Sets the day that the work week starts.
 Recurrence.Builder xrule(String name, String value)
          Adds a non-standard rule part.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Recurrence.Builder

public Recurrence.Builder(Recurrence.Frequency frequency)
Constructs a new builder.

Parameters:
frequency - the recurrence frequency

Recurrence.Builder

public Recurrence.Builder(Recurrence recur)
Constructs a new builder

Parameters:
recur - the recurrence object to copy from
Method Detail

frequency

public Recurrence.Builder frequency(Recurrence.Frequency frequency)
Sets the frequency

Parameters:
frequency - the frequency
Returns:
this

until

public Recurrence.Builder until(Date until)
Sets the date that the recurrence stops. Note that the UNTIL and COUNT fields cannot both be defined within the same rule.

Parameters:
until - the date (time component is included)
Returns:
this

until

public Recurrence.Builder until(Date until,
                                boolean hasTime)
Sets the date that the recurrence stops. Note that the UNTIL and COUNT fields cannot both be defined within the same rule.

Parameters:
until - the date
hasTime - true if the date has a time component, false if it's strictly a date
Returns:
this

count

public Recurrence.Builder count(Integer count)
Gets the number of times the rule will be repeated. Note that the UNTIL and COUNT fields cannot both be defined within the same rule.

Parameters:
count - the number of times to repeat the rule
Returns:
this

interval

public Recurrence.Builder interval(Integer interval)
Gets how often the rule repeats, in relation to the frequency.

Parameters:
interval - the repetition interval
Returns:
this

bySecond

public Recurrence.Builder bySecond(Integer bySecond)
Adds a BYSECOND rule part.

Parameters:
bySecond - the value to add
Returns:
this

byMinute

public Recurrence.Builder byMinute(Integer byMinute)
Adds a BYMINUTE rule part.

Parameters:
byMinute - the value to add
Returns:
this

byHour

public Recurrence.Builder byHour(Integer byHour)
Adds a BYHOUR rule part.

Parameters:
byHour - the value to add
Returns:
this

byMonthDay

public Recurrence.Builder byMonthDay(Integer byMonthDay)
Adds a BYMONTHDAY rule part.

Parameters:
byMonthDay - the value to add
Returns:
this

byYearDay

public Recurrence.Builder byYearDay(Integer byYearDay)
Adds a BYYEARDAY rule part.

Parameters:
byYearDay - the value to add
Returns:
this

byWeekNo

public Recurrence.Builder byWeekNo(Integer byWeekNo)
Adds a BYWEEKNO rule part.

Parameters:
byWeekNo - the value to add
Returns:
this

byMonth

public Recurrence.Builder byMonth(Integer byMonth)
Adds a BYMONTH rule part.

Parameters:
byMonth - the value to add
Returns:
this

bySetPos

public Recurrence.Builder bySetPos(Integer bySetPos)
Adds a BYSETPOS rule part.

Parameters:
bySetPos - the value to add
Returns:
this

byDay

public Recurrence.Builder byDay(Recurrence.DayOfWeek byDay)
Adds a BYDAY rule part.

Parameters:
byDay - the value to add
Returns:
this

byDay

public Recurrence.Builder byDay(Integer prefix,
                                Recurrence.DayOfWeek byDay)
Adds a BYDAY rule part.

Parameters:
prefix - the numeric prefix
byDay - the value to add
Returns:
this

workweekStarts

public Recurrence.Builder workweekStarts(Recurrence.DayOfWeek workweekStarts)
Sets the day that the work week starts.

Parameters:
workweekStarts - the day
Returns:
this

xrule

public Recurrence.Builder xrule(String name,
                                String value)
Adds a non-standard rule part.

Parameters:
name - the name
value - the value or null to remove the rule part
Returns:
this

build

public Recurrence build()
Builds the final Recurrence object.

Returns:
the object


Copyright © 2013 Michael Angstadt. All Rights Reserved.