Top Description Fields Constructors Methods
org.threeten.extra.chrono

public final Class AccountingChronologyBuilder

extends Object
Class Inheritance
Imports
java.time.DateTimeException, .DayOfWeek, .Month

Builder to create Accounting calendars.

Accounting calendars require setup before use, given how they are used. The following information is required:

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.

Field Summary

Modifier and TypeField and Description
private AccountingYearDivision
division

How to divide an accounting year.

private Month
end

Which Gregorian/ISO end-of-month the year ends in/is nearest to.

private DayOfWeek
endsOn

The day of the week on which a given Accounting year ends.

private boolean
inLastWeek

Whether the calendar ends in the last week of a given Gregorian/ISO month, or nearest to the last day of the month (will sometimes be in the next month).

private int
leapWeekInMonth

The month which will have the leap-week added.

private int
yearOffset

The offset to apply to the year.

Constructor Summary

AccessConstructor and Description
public
AccountingChronologyBuilder()

Constructs a new instance of the builder.

Method Summary

Modifier and TypeMethod and Description
public AccountingChronologyBuilder

Returns:

this, for chaining, not null.
accountingYearEndsInIsoYear
()

Sets the proleptic accounting year to end in the matching Iso year.

public AccountingChronologyBuilder

Returns:

this, for chaining, not null.
accountingYearStartsInIsoYear
()

Sets the proleptic accounting year to start in the matching Iso year.

public AccountingChronologyBuilder

Returns:

this, for chaining, not null.
endsOn
(DayOfWeek
The day-of-week on which a given Accounting calendar year ends.
endsOn
)

Sets the day-of-week on which a given Accounting calendar year ends.

public AccountingChronologyBuilder

Returns:

this, for chaining, not null.
inLastWeekOf
(Month
The Gregorian/ISO month-end a given Accounting calendar year ends in the last week of.
end
)

Sets the Gregorian/ISO month-end in which a given Accounting calendar year ends.

public AccountingChronologyBuilder

Returns:

this, for chaining, not null.
leapWeekInMonth
(int
The month in which the leap-week occurs.
leapWeekInMonth
)

Sets the month in which the leap-week occurs.

public AccountingChronologyBuilder

Returns:

this, for chaining, not null.
nearestEndOf
(Month
The Gregorian/ISO month-end a given Accounting calendar year ends nearest to.
end
)

Sets the Gregorian/ISO month-end which a given Accounting calendar year ends nearest to.

public AccountingChronology

Returns:

the created chronology, not null.
toChronology
()

Completes this builder by creating the AccountingChronology.

public AccountingChronologyBuilder

Returns:

this, for chaining, not null.
withDivision
(AccountingYearDivision
How to divide a given calendar year.
division
)

Sets how a given Accounting year will be divided.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

divisionback to summary
private AccountingYearDivision division

How to divide an accounting year.

endback to summary
private Month end

Which Gregorian/ISO end-of-month the year ends in/is nearest to.

endsOnback to summary
private DayOfWeek endsOn

The day of the week on which a given Accounting year ends.

inLastWeekback to summary
private boolean inLastWeek

Whether the calendar ends in the last week of a given Gregorian/ISO month, or nearest to the last day of the month (will sometimes be in the next month).

leapWeekInMonthback to summary
private int leapWeekInMonth

The month which will have the leap-week added.

yearOffsetback to summary
private int yearOffset

The offset to apply to the year.

Constructor Detail

AccountingChronologyBuilderback to summary
public AccountingChronologyBuilder()

Constructs a new instance of the builder.

Method Detail

accountingYearEndsInIsoYearback to summary
public AccountingChronologyBuilder accountingYearEndsInIsoYear()

Sets the proleptic accounting year to end in the matching Iso year.

Returns:AccountingChronologyBuilder

this, for chaining, not null.

accountingYearStartsInIsoYearback to summary
public AccountingChronologyBuilder accountingYearStartsInIsoYear()

Sets the proleptic accounting year to start in the matching Iso year.

Returns:AccountingChronologyBuilder

this, for chaining, not null.

endsOnback to summary
public AccountingChronologyBuilder endsOn(DayOfWeek endsOn)

Sets the day-of-week on which a given Accounting calendar year ends.

Parameters
endsOn:DayOfWeek

The day-of-week on which a given Accounting calendar year ends.

Returns:AccountingChronologyBuilder

this, for chaining, not null.

inLastWeekOfback to summary
public AccountingChronologyBuilder inLastWeekOf(Month end)

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:Month

The Gregorian/ISO month-end a given Accounting calendar year ends in the last week of.

Returns:AccountingChronologyBuilder

this, for chaining, not null.

leapWeekInMonthback to summary
public AccountingChronologyBuilder leapWeekInMonth(int leapWeekInMonth)

Sets the month in which the leap-week occurs.

Parameters
leapWeekInMonth:int

The month in which the leap-week occurs.

Returns:AccountingChronologyBuilder

this, for chaining, not null.

nearestEndOfback to summary
public AccountingChronologyBuilder nearestEndOf(Month end)

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:Month

The Gregorian/ISO month-end a given Accounting calendar year ends nearest to.

Returns:AccountingChronologyBuilder

this, for chaining, not null.

toChronologyback to summary
public AccountingChronology toChronology()

Completes this builder by creating the AccountingChronology.

Returns:AccountingChronology

the created chronology, not null.

Exceptions
DateTimeException:
if the chronology cannot be built.
withDivisionback to summary
public AccountingChronologyBuilder withDivision(AccountingYearDivision division)

Sets how a given Accounting year will be divided.

Parameters
division:AccountingYearDivision

How to divide a given calendar year.

Returns:AccountingChronologyBuilder

this, for chaining, not null.