Package org.threeten.extra.chrono
Class AccountingChronologyBuilder
java.lang.Object
org.threeten.extra.chrono.AccountingChronologyBuilder
Builder to create Accounting calendars.
Accounting calendars require setup before use, given how they are used. The following information is required:
- ending day-of-week - The day-of-week on which a given accounting year ends.
- last-in-month vs. nearest-end-of-month - Whether the ending day-of-week is the last in the month, or the nearest to the end of the month (will sometimes be in the next month.
- month end - Which Gregorian/ISO end-of-month the year ends in/is nearest to.
- year division - How many 'months' (periods) to divide the accounting year into, and how many weeks are in each.
- leap-week month - Which month will have the leap 'week' added to it. In practice this is probably the last one, but this does not seem to be required.
- year start/end offset - Whether the fiscal year starts or ends in the similarly numbered ISO year. If nearest-end-of-month is set and the ending month is December, the effective offset will shift over time.
There are approximately 7 x 2 x 12 x 4 x 12/13 x 2 = 8064 combinations.
Implementation Requirements
This class is a mutable builder suitable for use from a single thread.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSets the proleptic accounting year to end in the matching Iso year.Sets the proleptic accounting year to start in the matching Iso year.Sets the day-of-week on which a given Accounting calendar year ends.inLastWeekOf(Month end) Sets the Gregorian/ISO month-end in which a given Accounting calendar year ends.leapWeekInMonth(int leapWeekInMonth) Sets the month in which the leap-week occurs.nearestEndOf(Month end) Sets the Gregorian/ISO month-end which a given Accounting calendar year ends nearest to.Completes this builder by creating theAccountingChronology.withDivision(AccountingYearDivision division) Sets how a given Accounting year will be divided.
-
Constructor Details
-
AccountingChronologyBuilder
public AccountingChronologyBuilder()Constructs a new instance of the builder.
-
-
Method Details
-
endsOn
Sets the day-of-week on which a given Accounting calendar year ends.- Parameters:
endsOn- The day-of-week on which a given Accounting calendar year ends.- Returns:
- this, for chaining, not null.
-
nearestEndOf
Sets the Gregorian/ISO month-end which a given Accounting calendar year ends nearest to. Calendars setup this way will occasionally end in the start of the next month. For example, for July, the month ends on any day from July 28th to August 3rd.- Parameters:
end- The Gregorian/ISO month-end a given Accounting calendar year ends nearest to.- Returns:
- this, for chaining, not null.
-
inLastWeekOf
Sets the Gregorian/ISO month-end in which a given Accounting calendar year ends. Calendars setup this way will always end in the last week of the given month. For example, for July, the month ends on any day from July 25th to July 31st.- Parameters:
end- The Gregorian/ISO month-end a given Accounting calendar year ends in the last week of.- Returns:
- this, for chaining, not null.
-
withDivision
Sets how a given Accounting year will be divided.- Parameters:
division- How to divide a given calendar year.- Returns:
- this, for chaining, not null.
-
leapWeekInMonth
Sets the month in which the leap-week occurs.- Parameters:
leapWeekInMonth- The month in which the leap-week occurs.- Returns:
- this, for chaining, not null.
-
accountingYearEndsInIsoYear
Sets the proleptic accounting year to end in the matching Iso year.- Returns:
- this, for chaining, not null.
-
accountingYearStartsInIsoYear
Sets the proleptic accounting year to start in the matching Iso year.- Returns:
- this, for chaining, not null.
-
toChronology
Completes this builder by creating theAccountingChronology.- Returns:
- the created chronology, not null.
- Throws:
DateTimeException- if the chronology cannot be built.
-