public final class AccountingChronology extends AbstractChronology implements Serializable
This chronology defines the rules of a proleptic 52/53-week Accounting calendar system.
This calendar system follows the rules as laid down in IRS Publication 538
and the International Financial Reporting Standards.
The start of the Accounting calendar will vary against the ISO calendar.
Depending on options chosen, it can start as early as 0000-01-26 (ISO) or as late as 0001-01-04 (ISO).
This class is proleptic. It implements Accounting chronology rules for the entire time-line.
The fields are defined as follows:
| Modifier and Type | Method and Description |
|---|---|
AccountingDate |
date(Era era,
int yearOfEra,
int month,
int dayOfMonth)
Obtains a local date in Accounting calendar system from the
era, year-of-era, month-of-year and day-of-month fields.
|
AccountingDate |
date(int prolepticYear,
int month,
int dayOfMonth)
Obtains a local date in Accounting calendar system from the
proleptic-year, month-of-year and day-of-month fields.
|
AccountingDate |
date(TemporalAccessor temporal)
Obtains a Accounting local date from another date-time object.
|
AccountingDate |
dateEpochDay(long epochDay)
Obtains a local date in the Accounting calendar system from the epoch-day.
|
AccountingDate |
dateNow()
Obtains the current Accounting local date from the system clock in the default time-zone.
|
AccountingDate |
dateNow(Clock clock)
Obtains the current Accounting local date from the specified clock.
|
AccountingDate |
dateNow(ZoneId zone)
Obtains the current Accounting local date from the system clock in the specified time-zone.
|
AccountingDate |
dateYearDay(Era era,
int yearOfEra,
int dayOfYear)
Obtains a local date in Accounting calendar system from the
era, year-of-era and day-of-year fields.
|
AccountingDate |
dateYearDay(int prolepticYear,
int dayOfYear)
Obtains a local date in Accounting calendar system from the
proleptic-year and day-of-year fields.
|
boolean |
equals(Object obj) |
AccountingEra |
eraOf(int era) |
List<Era> |
eras() |
String |
getCalendarType()
Gets the calendar type of the underlying calendar system, which is null.
|
String |
getId()
Gets the ID of the chronology - 'Accounting'.
|
int |
hashCode() |
boolean |
isLeapYear(long prolepticYear)
Checks if the specified year is a leap year.
|
ChronoLocalDateTime<AccountingDate> |
localDateTime(TemporalAccessor temporal)
Obtains a Accounting local date-time from another date-time object.
|
int |
prolepticYear(Era era,
int yearOfEra) |
ValueRange |
range(ChronoField field) |
String |
toString() |
ChronoZonedDateTime<AccountingDate> |
zonedDateTime(Instant instant,
ZoneId zone)
Obtains a Accounting zoned date-time in this chronology from an
Instant. |
ChronoZonedDateTime<AccountingDate> |
zonedDateTime(TemporalAccessor temporal)
Obtains a Accounting zoned date-time from another date-time object.
|
compareTo, resolveDateclone, finalize, getClass, notify, notifyAll, wait, wait, waitfrom, getDisplayName, periodpublic String getId()
The ID uniquely identifies the Chronology,
but does not differentiate between instances of AccountingChronology.
It cannot be used to lookup the Chronology using AbstractChronology.of(String),
because each instance requires setup.
getId in interface ChronologygetCalendarType()public String getCalendarType()
The Unicode Locale Data Markup Language (LDML) specification does not define an identifier for 52/53 week calendars used for accounting purposes, and given that setup required is unlikely to do so. For this reason, the calendar type is null.
getCalendarType in interface ChronologygetId()public AccountingDate date(Era era, int yearOfEra, int month, int dayOfMonth)
date in interface Chronologyera - the Accounting era, not nullyearOfEra - the year-of-eramonth - the month-of-yeardayOfMonth - the day-of-monthDateTimeException - if unable to create the dateClassCastException - if the era is not a AccountingErapublic AccountingDate date(int prolepticYear, int month, int dayOfMonth)
date in interface ChronologyprolepticYear - the proleptic-yearmonth - the month-of-yeardayOfMonth - the day-of-monthDateTimeException - if unable to create the datepublic AccountingDate dateYearDay(Era era, int yearOfEra, int dayOfYear)
dateYearDay in interface Chronologyera - the Accounting era, not nullyearOfEra - the year-of-eradayOfYear - the day-of-yearDateTimeException - if unable to create the dateClassCastException - if the era is not a AccountingErapublic AccountingDate dateYearDay(int prolepticYear, int dayOfYear)
dateYearDay in interface ChronologyprolepticYear - the proleptic-yeardayOfYear - the day-of-yearDateTimeException - if unable to create the datepublic AccountingDate dateEpochDay(long epochDay)
dateEpochDay in interface ChronologyepochDay - the epoch dayDateTimeException - if unable to create the datepublic AccountingDate dateNow()
This will query the system clock in the default
time-zone to obtain the current date.
Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.
dateNow in interface ChronologyDateTimeException - if unable to create the datepublic AccountingDate dateNow(ZoneId zone)
This will query the system clock to obtain the current date.
Specifying the time-zone avoids dependence on the default time-zone.
Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.
dateNow in interface Chronologyzone - the zone ID to use, not nullDateTimeException - if unable to create the datepublic AccountingDate dateNow(Clock clock)
This will query the specified clock to obtain the current date - today.
Using this method allows the use of an alternate clock for testing.
The alternate clock may be introduced using dependency injection.
dateNow in interface Chronologyclock - the clock to use, not nullDateTimeException - if unable to create the datepublic AccountingDate date(TemporalAccessor temporal)
date in interface Chronologytemporal - the date-time object to convert, not nullDateTimeException - if unable to create the datepublic ChronoLocalDateTime<AccountingDate> localDateTime(TemporalAccessor temporal)
localDateTime in interface Chronologytemporal - the date-time object to convert, not nullDateTimeException - if unable to create the date-timepublic ChronoZonedDateTime<AccountingDate> zonedDateTime(TemporalAccessor temporal)
zonedDateTime in interface Chronologytemporal - the date-time object to convert, not nullDateTimeException - if unable to create the date-timepublic ChronoZonedDateTime<AccountingDate> zonedDateTime(Instant instant, ZoneId zone)
Instant.zonedDateTime in interface Chronologyinstant - the instant to create the date-time from, not nullzone - the time-zone, not nullDateTimeException - if the result exceeds the supported rangepublic boolean isLeapYear(long prolepticYear)
An Accounting proleptic-year is leap if the time between the end of the previous year and the end of the current year is 371 days. This method does not validate the year passed in, and only has a well-defined result for years in the supported range.
isLeapYear in interface ChronologyprolepticYear - the proleptic-year to check, not validated for rangepublic int prolepticYear(Era era, int yearOfEra)
prolepticYear in interface Chronologypublic AccountingEra eraOf(int era)
eraOf in interface Chronologypublic List<Era> eras()
eras in interface Chronologypublic ValueRange range(ChronoField field)
range in interface Chronologypublic boolean equals(Object obj)
equals in interface Chronologyequals in class AbstractChronologypublic int hashCode()
hashCode in interface ChronologyhashCode in class AbstractChronologypublic String toString()
toString in interface ChronologytoString in class AbstractChronologyCopyright © 2010–2016 ThreeTen.org. All rights reserved.