Serializable
, Comparable<Chronology>
, Chronology
public final class BritishCutoverChronology extends AbstractChronology implements Serializable
The British calendar system follows the rules of the Julian calendar until 1752 and the rules of the Gregorian (ISO) calendar since then. The Julian differs from the Gregorian only in terms of the leap year rule.
The Julian and Gregorian calendar systems are linked to Rome and the Vatican with the Julian preceding the Gregorian. The Gregorian was introduced to handle the drift of the seasons through the year due to the inaccurate Julian leap year rules. When first introduced by the Vatican in 1582, the cutover resulted in a "gap" of 10 days.
While the calendar was introduced in 1582, it was not adopted everywhere. Britain did not adopt it until the 1752, when Wednesday 2nd September 1752 was followed by Thursday 14th September 1752.
This chronology implements the proleptic Julian calendar system followed by
the proleptic Gregorian calendar system (identical to the ISO calendar system).
Dates are aligned such that 0001-01-01 (British)
is 0000-12-30 (ISO)
.
This class implements a calendar where January 1st is the start of the year. The history of the start of the year is complex and using the current standard is the most consistent.
The eras of this calendar system are defined by JulianEra
to avoid unnecessary duplication.
The fields are defined as follows:
Modifier and Type | Field | Description |
---|---|---|
static LocalDate |
CUTOVER |
The cutover date, Thursday 14th September 1752.
|
static BritishCutoverChronology |
INSTANCE |
Singleton instance for the Coptic chronology.
|
Constructor | Description |
---|---|
BritishCutoverChronology() |
Deprecated.
Use the singleton
INSTANCE instead. |
Modifier and Type | Method | Description |
---|---|---|
BritishCutoverDate |
date(int prolepticYear,
int month,
int dayOfMonth) |
Obtains a local date in British Cutover calendar system from the
proleptic-year, month-of-year and day-of-month fields.
|
BritishCutoverDate |
date(Era era,
int yearOfEra,
int month,
int dayOfMonth) |
Obtains a local date in British Cutover calendar system from the
era, year-of-era, month-of-year and day-of-month fields.
|
BritishCutoverDate |
date(TemporalAccessor temporal) |
Obtains a British Cutover local date from another date-time object.
|
BritishCutoverDate |
dateEpochDay(long epochDay) |
Obtains a local date in the British Cutover calendar system from the epoch-day.
|
BritishCutoverDate |
dateNow() |
Obtains the current British Cutover local date from the system clock in the default time-zone.
|
BritishCutoverDate |
dateNow(Clock clock) |
Obtains the current British Cutover local date from the specified clock.
|
BritishCutoverDate |
dateNow(ZoneId zone) |
Obtains the current British Cutover local date from the system clock in the specified time-zone.
|
BritishCutoverDate |
dateYearDay(int prolepticYear,
int dayOfYear) |
Obtains a local date in British Cutover calendar system from the
proleptic-year and day-of-year fields.
|
BritishCutoverDate |
dateYearDay(Era era,
int yearOfEra,
int dayOfYear) |
Obtains a local date in British Cutover calendar system from the
era, year-of-era and day-of-year fields.
|
JulianEra |
eraOf(int eraValue) |
|
List<Era> |
eras() |
|
String |
getCalendarType() |
Gets the calendar type of the underlying calendar system, which returns null.
|
LocalDate |
getCutover() |
Gets the cutover date between the Julian and Gregorian calendar.
|
String |
getId() |
Gets the ID of the chronology - 'BritishCutover'.
|
boolean |
isLeapYear(long prolepticYear) |
Checks if the specified year is a leap year.
|
ChronoLocalDateTime<BritishCutoverDate> |
localDateTime(TemporalAccessor temporal) |
Obtains a British Cutover local date-time from another date-time object.
|
int |
prolepticYear(Era era,
int yearOfEra) |
|
ValueRange |
range(ChronoField field) |
|
BritishCutoverDate |
resolveDate(Map<TemporalField,Long> fieldValues,
ResolverStyle resolverStyle) |
|
ChronoZonedDateTime<BritishCutoverDate> |
zonedDateTime(Instant instant,
ZoneId zone) |
Obtains a British Cutover zoned date-time in this chronology from an
Instant . |
ChronoZonedDateTime<BritishCutoverDate> |
zonedDateTime(TemporalAccessor temporal) |
Obtains a British Cutover zoned date-time from another date-time object.
|
compareTo, equals, hashCode, toString
epochSecond, epochSecond, from, getDisplayName, period
public static final BritishCutoverChronology INSTANCE
public static final LocalDate CUTOVER
@Deprecated public BritishCutoverChronology()
INSTANCE
instead.ServiceLoader
.public LocalDate getCutover()
The date returned is the first date that the Gregorian (ISO) calendar applies, which is Thursday 14th September 1752.
public String getId()
The ID uniquely identifies the Chronology
.
It can be used to lookup the Chronology
using Chronology.of(String)
.
getId
in interface Chronology
getCalendarType()
public String getCalendarType()
The Unicode Locale Data Markup Language (LDML) specification does not define an identifier for this calendar system, thus null is returned.
getCalendarType
in interface Chronology
getId()
public BritishCutoverDate date(Era era, int yearOfEra, int month, int dayOfMonth)
Dates in the middle of the cutover gap, such as the 10th September 1752, will not throw an exception. Instead, the date will be treated as a Julian date and converted to an ISO date, with the day of month shifted by 11 days.
date
in interface Chronology
era
- the British Cutover 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 JulianEra
public BritishCutoverDate date(int prolepticYear, int month, int dayOfMonth)
Dates in the middle of the cutover gap, such as the 10th September 1752, will not throw an exception. Instead, the date will be treated as a Julian date and converted to an ISO date, with the day of month shifted by 11 days.
date
in interface Chronology
prolepticYear
- the proleptic-yearmonth
- the month-of-yeardayOfMonth
- the day-of-monthDateTimeException
- if unable to create the datepublic BritishCutoverDate dateYearDay(Era era, int yearOfEra, int dayOfYear)
The day-of-year takes into account the cutover, thus there are only 355 days in 1752.
dateYearDay
in interface Chronology
era
- the British Cutover era, not nullyearOfEra
- the year-of-eradayOfYear
- the day-of-yearDateTimeException
- if unable to create the dateClassCastException
- if the era
is not a JulianEra
public BritishCutoverDate dateYearDay(int prolepticYear, int dayOfYear)
The day-of-year takes into account the cutover, thus there are only 355 days in 1752.
dateYearDay
in interface Chronology
prolepticYear
- the proleptic-yeardayOfYear
- the day-of-yearDateTimeException
- if unable to create the datepublic BritishCutoverDate dateEpochDay(long epochDay)
dateEpochDay
in interface Chronology
epochDay
- the epoch dayDateTimeException
- if unable to create the datepublic BritishCutoverDate 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 Chronology
DateTimeException
- if unable to create the datepublic BritishCutoverDate 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 Chronology
zone
- the zone ID to use, not nullDateTimeException
- if unable to create the datepublic BritishCutoverDate 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 Chronology
clock
- the clock to use, not nullDateTimeException
- if unable to create the datepublic BritishCutoverDate date(TemporalAccessor temporal)
date
in interface Chronology
temporal
- the date-time object to convert, not nullDateTimeException
- if unable to create the datepublic ChronoLocalDateTime<BritishCutoverDate> localDateTime(TemporalAccessor temporal)
localDateTime
in interface Chronology
temporal
- the date-time object to convert, not nullDateTimeException
- if unable to create the date-timepublic ChronoZonedDateTime<BritishCutoverDate> zonedDateTime(TemporalAccessor temporal)
zonedDateTime
in interface Chronology
temporal
- the date-time object to convert, not nullDateTimeException
- if unable to create the date-timepublic ChronoZonedDateTime<BritishCutoverDate> zonedDateTime(Instant instant, ZoneId zone)
Instant
.zonedDateTime
in interface Chronology
instant
- 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)
The result will return the same as JulianChronology.isLeapYear(long)
for
year 1752 and earlier, and IsoChronology.isLeapYear(long)
otherwise.
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 Chronology
prolepticYear
- the proleptic-year to check, not validated for rangepublic int prolepticYear(Era era, int yearOfEra)
prolepticYear
in interface Chronology
public JulianEra eraOf(int eraValue)
eraOf
in interface Chronology
public List<Era> eras()
eras
in interface Chronology
public ValueRange range(ChronoField field)
range
in interface Chronology
public BritishCutoverDate resolveDate(Map<TemporalField,Long> fieldValues, ResolverStyle resolverStyle)
resolveDate
in interface Chronology
resolveDate
in class AbstractChronology
Copyright © 2010–2019 ThreeTen.org. All rights reserved.