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

public final Class InternationalFixedChronology

extends AbstractChronology
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.Serializable, java.time.Clock, .DateTimeException, .Instant, .ZoneId, java.time.chrono.AbstractChronology, .ChronoLocalDateTime, .ChronoZonedDateTime, .Chronology, .Era, java.time.temporal.ChronoField, .TemporalAccessor, .ValueRange, java.util.Arrays, .List

The International Fixed calendar system.

This chronology defines the rules of the International Fixed calendar system. It shares the leap year rule with the Gregorian calendar. Dates are aligned such that 0001-01-01 (International Fixed) is 0001-01-01 (ISO).

This class is proleptic. It implements only years greater or equal to 1.

This class implements a calendar where January 1st is the start of the year.

The fields are defined as follows:

Implementation Requirements

This class is immutable and thread-safe.

Field Summary

Modifier and TypeField and Description
pack-priv static final ValueRange
DAY_OF_MONTH_RANGE

Range of day of month.

pack-priv static final ValueRange
DAY_OF_YEAR_LEAP_RANGE

Range of day of leap year.

pack-priv static final ValueRange
DAY_OF_YEAR_NORMAL_RANGE

Range of day of year.

pack-priv static final long
DAYS_0000_TO_1970

The number of days from year zero to year 1970, still the era only allows year 1 and higher.

pack-priv static final int
DAYS_IN_LONG_MONTH

There are 29 days in a long month.

pack-priv static final int
DAYS_IN_MONTH

There are 4 weeks of 7 days, or 28 total days in a month.

pack-priv static final int
DAYS_IN_WEEK

Standard 7-day week.

pack-priv static final int
DAYS_IN_YEAR

There are 13 months of 28 days, or 365 days in a (non-leap) year.

pack-priv static final int
DAYS_PER_CYCLE

The number of days in a 400 year cycle.

pack-priv static final ValueRange
EMPTY_RANGE

Empty range: [0, 0].

pack-priv static final ValueRange
EPOCH_DAY_RANGE

Epoch day range.

pack-priv static final ValueRange
ERA_RANGE

Range of eras.

public static final InternationalFixedChronology
INSTANCE

Singleton instance for the International fixed chronology.

pack-priv static final ValueRange
MONTH_OF_YEAR_RANGE

Range of month of year.

pack-priv static final int
MONTHS_IN_YEAR

There are 13 months in a year.

private static final ValueRange
PROLEPTIC_MONTH_RANGE

Range of proleptic month.

private static final long
serialVersionUID

Serialization version UID.

pack-priv static final int
WEEKS_IN_MONTH

In all months, there are 4 complete weeks.

pack-priv static final int
WEEKS_IN_YEAR

There are 52 weeks in a year.

pack-priv static final ValueRange
YEAR_RANGE

Range of year.

Constructor Summary

AccessConstructor and Description
public
InternationalFixedChronology()
Deprecated Use the singleton INSTANCE instead.

Private constructor, that is public to satisfy the ServiceLoader.

Method Summary

Modifier and TypeMethod and Description
public InternationalFixedDate

Returns:

the International Fixed local date, not null
date
(Era
the International Fixed era, not null
era
,
int
the year-of-era
yearOfEra
,
int
the month-of-year
month
,
int
the day-of-month
dayOfMonth
)

Overrides default java.time.chrono.Chronology.date.

Obtains a local date in International Fixed calendar system from the era, year-of-era, month-of-year and day-of-month fields.

public InternationalFixedDate

Returns:

the International Fixed local date, not null
date
(int
the proleptic-year
prolepticYear
,
int
the month-of-year
month
,
int
the day-of-month
dayOfMonth
)

Implements java.time.chrono.Chronology.date.

Obtains a local date in International Fixed calendar system from the proleptic-year, month-of-year and day-of-month fields.

public InternationalFixedDate

Returns:

the International Fixed local date, not null
date
(TemporalAccessor
the date-time object to convert, not null
temporal
)

Implements java.time.chrono.Chronology.date.

Obtains a International Fixed local date from another date-time object.

public InternationalFixedDate

Returns:

the International Fixed local date, not null
dateEpochDay
(long
the epoch day
epochDay
)

Implements java.time.chrono.Chronology.dateEpochDay.

Obtains a local date in the International Fixed calendar system from the epoch-day.

public InternationalFixedDate

Returns:

the current International Fixed local date using the system clock and default time-zone, not null
dateNow
()

Overrides default java.time.chrono.Chronology.dateNow.

Obtains the current International Fixed local date from the system clock in the default time-zone.

public InternationalFixedDate

Returns:

the current International Fixed local date using the system clock, not null
dateNow
(ZoneId
the zone ID to use, not null
zone
)

Overrides default java.time.chrono.Chronology.dateNow.

Obtains the current International Fixed local date from the system clock in the specified time-zone.

public InternationalFixedDate

Returns:

the current International Fixed local date, not null
dateNow
(Clock
the clock to use, not null
clock
)

Overrides default java.time.chrono.Chronology.dateNow.

Obtains the current International Fixed local date from the specified clock.

public InternationalFixedDate

Returns:

the International Fixed local date, not null
dateYearDay
(Era
the International Fixed era, not null
era
,
int
the year-of-era
yearOfEra
,
int
the day-of-year
dayOfYear
)

Overrides default java.time.chrono.Chronology.dateYearDay.

Obtains a local date in International Fixed calendar system from the era, year-of-era and day-of-year fields.

public InternationalFixedDate

Returns:

the International Fixed local date, not null
dateYearDay
(int
the proleptic-year
prolepticYear
,
int
the day-of-year
dayOfYear
)

Implements java.time.chrono.Chronology.dateYearDay.

Obtains a local date in International Fixed calendar system from the proleptic-year and day-of-year fields.

public InternationalFixedEra

Returns:

the calendar system era, not null
eraOf
(int
the era value
eraValue
)

Implements java.time.chrono.Chronology.eraOf.

Creates the chronology era object from the numeric value.

public List<Era>

Returns:

the list of eras for the chronology, may be immutable, not null
eras
()

Implements java.time.chrono.Chronology.eras.

Gets the list of eras for the chronology.

public String

Returns:

the calendar system type, null
getCalendarType
()

Implements java.time.chrono.Chronology.getCalendarType.

Gets the calendar type of the underlying calendar system, which returns null.

public String

Returns:

the chronology ID - 'Ifc'
getId
()

Implements java.time.chrono.Chronology.getId.

Gets the ID of the chronology - 'Ifc'.

pack-priv static long

Returns:

The number of leap years since International fixed year 1.
getLeapYearsBefore
(long
The year.
prolepticYear
)

Get the count of leap years since International fixed year 1.

public boolean

Returns:

true if the year is a leap year
isLeapYear
(long
the proleptic-year to check, not validated for range
year
)

Implements java.time.chrono.Chronology.isLeapYear.

Checks if the specified year is a leap year.

public ChronoLocalDateTime<InternationalFixedDate>

Returns:

the International Fixed local date-time, not null
localDateTime
(TemporalAccessor
the date-time object to convert, not null
temporal
)

Overrides default java.time.chrono.Chronology.localDateTime.

Obtains a International Fixed local date-time from another date-time object.

public int
prolepticYear(Era
the era of the correct type for the chronology, not null
era
,
int
the chronology year-of-era
yearOfEra
)

Implements java.time.chrono.Chronology.prolepticYear.

Calculates the proleptic-year given the era and year-of-era.

public ValueRange
range(ChronoField
the field to get the range for, not null
field
)

Implements java.time.chrono.Chronology.range.

Gets the range of valid values for the specified field.

private Object

Returns:

the singleton instance, not null
readResolve
()

Resolve singleton.

public ChronoZonedDateTime<InternationalFixedDate>

Returns:

the International Fixed zoned date-time, not null
zonedDateTime
(TemporalAccessor
the date-time object to convert, not null
temporal
)

Overrides default java.time.chrono.Chronology.zonedDateTime.

Obtains a International Fixed zoned date-time from another date-time object.

public ChronoZonedDateTime<InternationalFixedDate>

Returns:

the International Fixed zoned date-time, not null
zonedDateTime
(Instant
the instant to create the date-time from, not null
instant
,
ZoneId
the time-zone, not null
zone
)

Overrides default java.time.chrono.Chronology.zonedDateTime.

Obtains a International Fixed zoned date-time in this chronology from an Instant.

Inherited from java.time.chrono.AbstractChronology:
compareToequalshashCoderesolveDatetoString

Field Detail

DAY_OF_MONTH_RANGEback to summary
pack-priv static final ValueRange DAY_OF_MONTH_RANGE

Range of day of month.

DAY_OF_YEAR_LEAP_RANGEback to summary
pack-priv static final ValueRange DAY_OF_YEAR_LEAP_RANGE

Range of day of leap year.

DAY_OF_YEAR_NORMAL_RANGEback to summary
pack-priv static final ValueRange DAY_OF_YEAR_NORMAL_RANGE

Range of day of year.

DAYS_0000_TO_1970back to summary
pack-priv static final long DAYS_0000_TO_1970

The number of days from year zero to year 1970, still the era only allows year 1 and higher. There are five 400 year cycles from year zero to 2000. There are 7 leap years from 1970 to 2000.

DAYS_IN_LONG_MONTHback to summary
pack-priv static final int DAYS_IN_LONG_MONTH

There are 29 days in a long month.

DAYS_IN_MONTHback to summary
pack-priv static final int DAYS_IN_MONTH

There are 4 weeks of 7 days, or 28 total days in a month.

DAYS_IN_WEEKback to summary
pack-priv static final int DAYS_IN_WEEK

Standard 7-day week.

DAYS_IN_YEARback to summary
pack-priv static final int DAYS_IN_YEAR

There are 13 months of 28 days, or 365 days in a (non-leap) year.

DAYS_PER_CYCLEback to summary
pack-priv static final int DAYS_PER_CYCLE

The number of days in a 400 year cycle.

EMPTY_RANGEback to summary
pack-priv static final ValueRange EMPTY_RANGE

Empty range: [0, 0].

EPOCH_DAY_RANGEback to summary
pack-priv static final ValueRange EPOCH_DAY_RANGE

Epoch day range.

ERA_RANGEback to summary
pack-priv static final ValueRange ERA_RANGE

Range of eras.

INSTANCEback to summary
public static final InternationalFixedChronology INSTANCE

Singleton instance for the International fixed chronology.

MONTH_OF_YEAR_RANGEback to summary
pack-priv static final ValueRange MONTH_OF_YEAR_RANGE

Range of month of year.

MONTHS_IN_YEARback to summary
pack-priv static final int MONTHS_IN_YEAR

There are 13 months in a year.

PROLEPTIC_MONTH_RANGEback to summary
private static final ValueRange PROLEPTIC_MONTH_RANGE

Range of proleptic month.

serialVersionUIDback to summary
private static final long serialVersionUID

Serialization version UID.

WEEKS_IN_MONTHback to summary
pack-priv static final int WEEKS_IN_MONTH

In all months, there are 4 complete weeks.

WEEKS_IN_YEARback to summary
pack-priv static final int WEEKS_IN_YEAR

There are 52 weeks in a year.

YEAR_RANGEback to summary
pack-priv static final ValueRange YEAR_RANGE

Range of year.

Constructor Detail

InternationalFixedChronologyback to summary
public InternationalFixedChronology()

Deprecated

Use the singleton INSTANCE instead.

Private constructor, that is public to satisfy the ServiceLoader.

Annotations
@Deprecated

Method Detail

dateback to summary
public InternationalFixedDate date(Era era, int yearOfEra, int month, int dayOfMonth)

Overrides default java.time.chrono.Chronology.date.

Obtains a local date in International Fixed calendar system from the era, year-of-era, month-of-year and day-of-month fields.

Parameters
era:Era

the International Fixed era, not null

yearOfEra:int

the year-of-era

month:int

the month-of-year

dayOfMonth:int

the day-of-month

Returns:InternationalFixedDate

the International Fixed local date, not null

Annotations
@Override
Exceptions
DateTimeException:
if unable to create the date
ClassCastException:
if the era is not a InternationalFixedEra
dateback to summary
public InternationalFixedDate date(int prolepticYear, int month, int dayOfMonth)

Implements java.time.chrono.Chronology.date.

Obtains a local date in International Fixed calendar system from the proleptic-year, month-of-year and day-of-month fields.

Parameters
prolepticYear:int

the proleptic-year

month:int

the month-of-year

dayOfMonth:int

the day-of-month

Returns:InternationalFixedDate

the International Fixed local date, not null

Annotations
@Override
Exceptions
DateTimeException:
if unable to create the date
dateback to summary
public InternationalFixedDate date(TemporalAccessor temporal)

Implements java.time.chrono.Chronology.date.

Obtains a International Fixed local date from another date-time object.

Parameters
temporal:TemporalAccessor

the date-time object to convert, not null

Returns:InternationalFixedDate

the International Fixed local date, not null

Annotations
@Override
Exceptions
DateTimeException:
if unable to create the date
dateEpochDayback to summary
public InternationalFixedDate dateEpochDay(long epochDay)

Implements java.time.chrono.Chronology.dateEpochDay.

Obtains a local date in the International Fixed calendar system from the epoch-day.

Parameters
epochDay:long

the epoch day

Returns:InternationalFixedDate

the International Fixed local date, not null

Annotations
@Override
Exceptions
DateTimeException:
if unable to create the date
dateNowback to summary
public InternationalFixedDate dateNow()

Overrides default java.time.chrono.Chronology.dateNow.

Obtains the current International Fixed local date from the system clock in the default time-zone.

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.

Returns:InternationalFixedDate

the current International Fixed local date using the system clock and default time-zone, not null

Annotations
@Override
Exceptions
DateTimeException:
if unable to create the date
dateNowback to summary
public InternationalFixedDate dateNow(ZoneId zone)

Overrides default java.time.chrono.Chronology.dateNow.

Obtains the current International Fixed local date from the system clock in the specified time-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.

Parameters
zone:ZoneId

the zone ID to use, not null

Returns:InternationalFixedDate

the current International Fixed local date using the system clock, not null

Annotations
@Override
Exceptions
DateTimeException:
if unable to create the date
dateNowback to summary
public InternationalFixedDate dateNow(Clock clock)

Overrides default java.time.chrono.Chronology.dateNow.

Obtains the current International Fixed local date from the specified 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.

Parameters
clock:Clock

the clock to use, not null

Returns:InternationalFixedDate

the current International Fixed local date, not null

Annotations
@Override
Exceptions
DateTimeException:
if unable to create the date
dateYearDayback to summary
public InternationalFixedDate dateYearDay(Era era, int yearOfEra, int dayOfYear)

Overrides default java.time.chrono.Chronology.dateYearDay.

Obtains a local date in International Fixed calendar system from the era, year-of-era and day-of-year fields.

Parameters
era:Era

the International Fixed era, not null

yearOfEra:int

the year-of-era

dayOfYear:int

the day-of-year

Returns:InternationalFixedDate

the International Fixed local date, not null

Annotations
@Override
Exceptions
DateTimeException:
if unable to create the date
ClassCastException:
if the era is not a InternationalFixedEra
dateYearDayback to summary
public InternationalFixedDate dateYearDay(int prolepticYear, int dayOfYear)

Implements java.time.chrono.Chronology.dateYearDay.

Obtains a local date in International Fixed calendar system from the proleptic-year and day-of-year fields.

Parameters
prolepticYear:int

the proleptic-year

dayOfYear:int

the day-of-year

Returns:InternationalFixedDate

the International Fixed local date, not null

Annotations
@Override
Exceptions
DateTimeException:
if unable to create the date
eraOfback to summary
public InternationalFixedEra eraOf(int eraValue)

Implements java.time.chrono.Chronology.eraOf.

Creates the chronology era object from the numeric value.

Only one era is supported, CE, with the value 1.

Parameters
eraValue:int

the era value

Returns:InternationalFixedEra

the calendar system era, not null

Annotations
@Override
Exceptions
DateTimeException:
if unable to create the era
erasback to summary
public List<Era> eras()

Implements java.time.chrono.Chronology.eras.

Gets the list of eras for the chronology.

Only one era is supported, CE, with the value 1.

Returns:List<Era>

the list of eras for the chronology, may be immutable, not null

Annotations
@Override
getCalendarTypeback to summary
public String getCalendarType()

Implements java.time.chrono.Chronology.getCalendarType.

Gets the calendar type of the underlying calendar system, which returns null.

The Unicode Locale Data Markup Language (LDML) specification does not define an identifier for this calendar system, thus null is returned.

Returns:String

the calendar system type, null

Annotations
@Override
See Also
getId()
getIdback to summary
public String getId()

Implements java.time.chrono.Chronology.getId.

Gets the ID of the chronology - 'Ifc'.

The ID uniquely identifies the Chronology. It can be used to lookup the Chronology using Chronology#of(String).

Returns:String

the chronology ID - 'Ifc'

Annotations
@Override
See Also
getCalendarType()
getLeapYearsBeforeback to summary
pack-priv static long getLeapYearsBefore(long prolepticYear)

Get the count of leap years since International fixed year 1.

Parameters
prolepticYear:long

The year.

Returns:long

The number of leap years since International fixed year 1.

isLeapYearback to summary
public boolean isLeapYear(long year)

Implements java.time.chrono.Chronology.isLeapYear.

Checks if the specified year is a leap year.

A leap-year is a year of a longer length than normal. Leap years in the calendar system match those of the ISO calendar system.

Parameters
year:long

the proleptic-year to check, not validated for range

Returns:boolean

true if the year is a leap year

Annotations
@Override
localDateTimeback to summary
public ChronoLocalDateTime<InternationalFixedDate> localDateTime(TemporalAccessor temporal)

Overrides default java.time.chrono.Chronology.localDateTime.

Obtains a International Fixed local date-time from another date-time object.

Parameters
temporal:TemporalAccessor

the date-time object to convert, not null

Returns:ChronoLocalDateTime<InternationalFixedDate>

the International Fixed local date-time, not null

Annotations
@Override
@SuppressWarnings:unchecked
Exceptions
DateTimeException:
if unable to create the date-time
prolepticYearback to summary
public int prolepticYear(Era era, int yearOfEra)

Implements java.time.chrono.Chronology.prolepticYear.

Doc from java.time.chrono.Chronology.prolepticYear.

Calculates the proleptic-year given the era and year-of-era.

This combines the era and year-of-era into the single proleptic-year field.

If the chronology makes active use of eras, such as JapaneseChronology then the year-of-era will be validated against the era. For other chronologies, validation is optional.

Parameters
era:Era

the era of the correct type for the chronology, not null

yearOfEra:int

the chronology year-of-era

Returns:int

the proleptic-year

Annotations
@Override
rangeback to summary
public ValueRange range(ChronoField field)

Implements java.time.chrono.Chronology.range.

Doc from java.time.chrono.Chronology.range.

Gets the range of valid values for the specified field.

All fields can be expressed as a long integer. This method returns an object that describes the valid range for that value.

Note that the result only describes the minimum and maximum valid values and it is important not to read too much into them. For example, there could be values within the range that are invalid for the field.

This method will return a result whether or not the chronology supports the field.

Parameters
field:ChronoField

the field to get the range for, not null

Returns:ValueRange

the range of valid values for the field, not null

Annotations
@Override
readResolveback to summary
private Object readResolve()

Resolve singleton.

Returns:Object

the singleton instance, not null

Annotations
@SuppressWarnings:static-method
zonedDateTimeback to summary
public ChronoZonedDateTime<InternationalFixedDate> zonedDateTime(TemporalAccessor temporal)

Overrides default java.time.chrono.Chronology.zonedDateTime.

Obtains a International Fixed zoned date-time from another date-time object.

Parameters
temporal:TemporalAccessor

the date-time object to convert, not null

Returns:ChronoZonedDateTime<InternationalFixedDate>

the International Fixed zoned date-time, not null

Annotations
@Override
@SuppressWarnings:unchecked
Exceptions
DateTimeException:
if unable to create the date-time
zonedDateTimeback to summary
public ChronoZonedDateTime<InternationalFixedDate> zonedDateTime(Instant instant, ZoneId zone)

Overrides default java.time.chrono.Chronology.zonedDateTime.

Obtains a International Fixed zoned date-time in this chronology from an Instant.

Parameters
instant:Instant

the instant to create the date-time from, not null

zone:ZoneId

the time-zone, not null

Returns:ChronoZonedDateTime<InternationalFixedDate>

the International Fixed zoned date-time, not null

Annotations
@Override
@SuppressWarnings:unchecked
Exceptions
DateTimeException:
if the result exceeds the supported range