Creates an instance.
Adds a field-value pair to the map, checking for conflicts. !(p) If the field is not already present, then the field-value pair is added to the map. If the field is already present and it has the same value as that specified, no action occurs. If the field is already present and it has a different value to that specified, then an exception is thrown.
Compares this chronology to another chronology. !(p) The comparison order first by the chronology ID string, then by any additional information specific to the subclass. It is "consistent with equals", as defined by {@link Comparable}.
Checks if this chronology is equal to another chronology. <p> The comparison is based on the entire state of the object.
Resolves parsed {@code ChronoField} values into a date during parsing. <p> Most {@code TemporalField} implementations are resolved using the resolve method on the field. By contrast, the {@code ChronoField} class defines fields that only have meaning relative to the chronology. As such, {@code ChronoField} date fields are resolved here _in the context of a specific chronology. <p> {@code ChronoField} instances are resolved by this method, which may be overridden _in subclasses. <ul> <li>{@code EPOCH_DAY} - If present, this is converted to a date and all other date fields are then cross-checked against the date. <li>{@code PROLEPTIC_MONTH} - If present, then it is split into the {@code YEAR} and {@code MONTH_OF_YEAR}. If the mode is strict or smart then the field is validated. <li>{@code YEAR_OF_ERA} and {@code ERA} - If both are present, then they are combined to form a {@code YEAR}. In lenient mode, the {@code YEAR_OF_ERA} range is not validated, _in smart and strict mode it is. The {@code ERA} is validated for range _in all three modes. If only the {@code YEAR_OF_ERA} is present, and the mode is smart or lenient, then the last available era is assumed. In strict mode, no era is assumed and the {@code YEAR_OF_ERA} is left untouched. If only the {@code ERA} is present, then it is left untouched. <li>{@code YEAR}, {@code MONTH_OF_YEAR} and {@code DAY_OF_MONTH} - If all three are present, then they are combined to form a date. In all three modes, the {@code YEAR} is validated. If the mode is smart or strict, then the month and day are validated. If the mode is lenient, then the date is combined _in a manner equivalent to creating a date on the first day of the first month _in the requested year, then adding the difference _in months, then the difference _in days. If the mode is smart, and the day-of-month is greater than the maximum for the year-month, then the day-of-month is adjusted to the last day-of-month. If the mode is strict, then the three fields must form a valid date. <li>{@code YEAR} and {@code DAY_OF_YEAR} - If both are present, then they are combined to form a date. In all three modes, the {@code YEAR} is validated. If the mode is lenient, then the date is combined _in a manner equivalent to creating a date on the first day of the requested year, then adding the difference _in days. If the mode is smart or strict, then the two fields must form a valid date. <li>{@code YEAR}, {@code MONTH_OF_YEAR}, {@code ALIGNED_WEEK_OF_MONTH} and {@code ALIGNED_DAY_OF_WEEK_IN_MONTH} - If all four are present, then they are combined to form a date. In all three modes, the {@code YEAR} is validated. If the mode is lenient, then the date is combined _in a manner equivalent to creating a date on the first day of the first month _in the requested year, then adding the difference _in months, then the difference _in weeks, then _in days. If the mode is smart or strict, then the all four fields are validated to their outer ranges. The date is then combined _in a manner equivalent to creating a date on the first day of the requested year and month, then adding the amount _in weeks and days to reach their values. If the mode is strict, the date is additionally validated to check that the day and week adjustment did not change the month. <li>{@code YEAR}, {@code MONTH_OF_YEAR}, {@code ALIGNED_WEEK_OF_MONTH} and {@code DAY_OF_WEEK} - If all four are present, then they are combined to form a date. The approach is the same as described above for years, months and weeks _in {@code ALIGNED_DAY_OF_WEEK_IN_MONTH}. The day-of-week is adjusted as the next or same matching day-of-week once the years, months and weeks have been handled. <li>{@code YEAR}, {@code ALIGNED_WEEK_OF_YEAR} and {@code ALIGNED_DAY_OF_WEEK_IN_YEAR} - If all three are present, then they are combined to form a date. In all three modes, the {@code YEAR} is validated. If the mode is lenient, then the date is combined _in a manner equivalent to creating a date on the first day of the requested year, then adding the difference _in weeks, then _in days. If the mode is smart or strict, then the all three fields are validated to their outer ranges. The date is then combined _in a manner equivalent to creating a date on the first day of the requested year, then adding the amount _in weeks and days to reach their values. If the mode is strict, the date is additionally validated to check that the day and week adjustment did not change the year. <li>{@code YEAR}, {@code ALIGNED_WEEK_OF_YEAR} and {@code DAY_OF_WEEK} - If all three are present, then they are combined to form a date. The approach is the same as described above for years and weeks _in {@code ALIGNED_DAY_OF_WEEK_IN_YEAR}. The day-of-week is adjusted as the next or same matching day-of-week once the years and weeks have been handled. </ul> <p> The default implementation is suitable for most calendar systems. If {@link hunt.time.temporal.ChronoField#YEAR_OF_ERA} is found without an {@link hunt.time.temporal.ChronoField#ERA} then the last era _in {@link #eras()} is used. The implementation assumes a 7 day week, that the first day-of-month has the value 1, that first day-of-year has the value 1, and that the first of the month and year always exists.
A hash code for this chronology. <p> The hash code should be based on the entire state of the object.
Outputs this chronology as a {@code string}, using the chronology ID.
Defend against malicious streams.
Writes the Chronology using a <a href="{@docRoot}/serialized-form.html#hunt.time.chrono.Ser">dedicated serialized form</a>. <pre> _out.writeByte(1); // identifies this as a Chronology _out.writeUTF(getId()); </pre>
Map of available calendars by calendar type.
Returns the available chronologies. !(p) Each returned {@code Chronology} is available for use _in the system. The set of chronologies includes the system chronologies and any chronologies provided by the application via ServiceLoader configuration.
Obtains an instance of {@code Chronology} from a chronology ID or calendar system type. !(p) See {@link Chronology#of(string)}.
Obtains an instance of {@code Chronology} from a locale. !(p) See {@link Chronology#ofLocale(Locale)}.
Register a Chronology by its ID and type for lookup by {@link #of(string)}. Chronologies must not be registered until they are completely constructed. Specifically, not _in the constructor of Chronology.
Register a Chronology by ID and type for lookup by {@link #of(string)}. Chronos must not be registered until they are completely constructed. Specifically, not _in the constructor of Chronology.
Obtains an instance of {@code Chronology} from a temporal object. !(p) This obtains a chronology based on the specified temporal. A {@code TemporalAccessor} represents an arbitrary set of date and time information, which this factory converts to an instance of {@code Chronology}. !(p) The conversion will obtain the chronology using {@link TemporalQueries#chronology()}. If the specified temporal object does not have a chronology, {@link IsoChronology} is returned. !(p) This method matches the signature of the functional interface {@link TemporalQuery} allowing it to be used as a query via method reference, {@code Chronology::from}.
Obtains an instance of {@code Chronology} from a locale. !(p) This returns a {@code Chronology} based on the specified locale, typically returning {@code IsoChronology}. Other calendar systems are only returned if they are explicitly selected within the locale. !(p) The {@link Locale} class provide access to a range of information useful for localizing an application. This includes the language and region, such as "en-GB" for English as used _in Great Britain. !(p) The {@code Locale} class also supports an extension mechanism that can be used to identify a calendar system. The mechanism is a form of key-value pairs, where the calendar system has the key "ca". For example, the locale "en-JP-u-ca-japanese" represents the English language as used _in Japan with the Japanese calendar system. !(p) This method finds the desired calendar system _in a manner equivalent to passing "ca" to {@link Locale#getUnicodeLocaleType(string)}. If the "ca" key is not present, then {@code IsoChronology} is returned. !(p) Note that the behavior of this method differs from the older {@link java.util.Calendar#getInstance(Locale)} method. If that method receives a locale of "th_TH" it will return {@code BuddhistCalendar}. By contrast, this method will return {@code IsoChronology}. Passing the locale "th-TH-u-ca-buddhist" into either method will result _in the Thai Buddhist calendar system and is therefore the recommended approach going forward for Thai calendar system localization. !(p) A similar, but simpler, situation occurs for the Japanese calendar system. The locale "jp_JP_JP" has previously been used to access the calendar. However, unlike the Thai locale, "ja_JP_JP" is automatically converted by {@code Locale} to the modern and recommended form of "ja-JP-u-ca-japanese". Thus, there is no difference _in behavior between this method and {@code Calendar#getInstance(Locale)}.
Obtains an instance of {@code Chronology} from a chronology ID or calendar system type. !(p) This returns a chronology based on either the ID or the type. The {@link #getId() chronology ID} uniquely identifies the chronology. The {@link #getCalendarType() calendar system type} is defined by the CLDR specification. !(p) The chronology may be a system chronology or a chronology provided by the application via ServiceLoader configuration. !(p) Since some calendars can be customized, the ID or type typically refers to the customization. For example, the Gregorian calendar can have multiple cutover dates from the Julian, but the lookup only provides the cutover date.
Returns the available chronologies. !(p) Each returned {@code Chronology} is available for use _in the system. The set of chronologies includes the system chronologies and any chronologies provided by the application via ServiceLoader configuration.
Gets the ID of the chronology. !(p) The ID uniquely identifies the {@code Chronology}. It can be used to lookup the {@code Chronology} using {@link #of(string)}.
Gets the calendar type of the calendar system. !(p) The calendar type is an identifier defined by the CLDR and !(em)Unicode Locale Data Markup Language (LDML)</em> specifications to uniquely identify a calendar. The {@code getCalendarType} is the concatenation of the CLDR calendar type and the variant, if applicable, is appended separated by "-". The calendar type is used to lookup the {@code Chronology} using {@link #of(string)}.
Obtains a local date _in this chronology from the era, year-of-era, month-of-year and day-of-month fields.
Obtains a local date _in this chronology from the proleptic-year, month-of-year and day-of-month fields.
Obtains a local date _in this chronology from the era, year-of-era and day-of-year fields.
Obtains a local date _in this chronology from the proleptic-year and day-of-year fields.
Obtains a local date _in this chronology from the epoch-day. !(p) The definition of {@link ChronoField#EPOCH_DAY EPOCH_DAY} is the same for all calendar systems, thus it can be used for conversion.
Obtains the current local date _in this chronology from the system clock _in the time-zone. !(p) This will query the {@link Clock#systemDefaultZone() system clock} _in the time-zone to obtain the current date. !(p) Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.
Obtains the current local date _in this chronology from the system clock _in the specified time-zone. !(p) This will query the {@link Clock#system(ZoneId) system clock} to obtain the current date. Specifying the time-zone avoids dependence on the time-zone. !(p) Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.
Obtains the current local date _in this chronology from the specified clock. !(p) 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 {@link Clock dependency injection}.
Obtains a local date _in this chronology from another temporal object. !(p) This obtains a date _in this chronology based on the specified temporal. A {@code TemporalAccessor} represents an arbitrary set of date and time information, which this factory converts to an instance of {@code ChronoLocalDate}. !(p) The conversion typically uses the {@link ChronoField#EPOCH_DAY EPOCH_DAY} field, which is standardized across calendar systems. !(p) This method matches the signature of the functional interface {@link TemporalQuery} allowing it to be used as a query via method reference, {@code aChronology::date}.
Obtains a local date-time _in this chronology from another temporal object. !(p) This obtains a date-time _in this chronology based on the specified temporal. A {@code TemporalAccessor} represents an arbitrary set of date and time information, which this factory converts to an instance of {@code ChronoLocalDateTime}. !(p) The conversion extracts and combines the {@code ChronoLocalDate} and the {@code LocalTime} from the temporal object. Implementations are permitted to perform optimizations such as accessing those fields that are equivalent to the relevant objects. The result uses this chronology. !(p) This method matches the signature of the functional interface {@link TemporalQuery} allowing it to be used as a query via method reference, {@code aChronology::localDateTime}.
Obtains a {@code ChronoZonedDateTime} _in this chronology from another temporal object. !(p) This obtains a zoned date-time _in this chronology based on the specified temporal. A {@code TemporalAccessor} represents an arbitrary set of date and time information, which this factory converts to an instance of {@code ChronoZonedDateTime}. !(p) The conversion will first obtain a {@code ZoneId} from the temporal object, falling back to a {@code ZoneOffset} if necessary. It will then try to obtain an {@code Instant}, falling back to a {@code ChronoLocalDateTime} if necessary. The result will be either the combination of {@code ZoneId} or {@code ZoneOffset} with {@code Instant} or {@code ChronoLocalDateTime}. Implementations are permitted to perform optimizations such as accessing those fields that are equivalent to the relevant objects. The result uses this chronology. !(p) This method matches the signature of the functional interface {@link TemporalQuery} allowing it to be used as a query via method reference, {@code aChronology::zonedDateTime}.
Obtains a {@code ChronoZonedDateTime} _in this chronology from an {@code Instant}. !(p) This obtains a zoned date-time with the same instant as that specified.
Checks if the specified year is a leap year. !(p) A leap-year is a year of a longer length than normal. The exact meaning is determined by the chronology according to the following constraints. !(ul) !(li)a leap-year must imply a year-length longer than a non leap-year. !(li)a chronology that does not support the concept of a year must return false. !(li)the correct result must be returned for all years within the valid range of years for the chronology. </ul> !(p) Outside the range of valid years an implementation is free to return either a best guess or false. An implementation must not throw an exception, even if the year is outside the range of valid years.
Calculates the proleptic-year given the era and year-of-era. !(p) This combines the era and year-of-era into the single proleptic-year field. !(p) If the chronology makes active use of eras, such as {@code JapaneseChronology} then the year-of-era will be validated against the era. For other chronologies, validation is optional.
Creates the chronology era object from the numeric value. !(p) The era is, conceptually, the largest division of the time-line. Most calendar systems have a single epoch dividing the time-line into two eras. However, some have multiple eras, such as one for the reign of each leader. The exact meaning is determined by the chronology according to the following constraints. !(p) The era _in use at 1970-01-01 must have the value 1. Later eras must have sequentially higher values. Earlier eras must have sequentially lower values. Each chronology must refer to an enum or similar singleton to provide the era values. !(p) This method returns the singleton era of the correct type for the specified era value.
Gets the list of eras for the chronology. !(p) Most calendar systems have an era, within which the year has meaning. If the calendar system does not support the concept of eras, an empty list must be returned.
Gets the range of valid values for the specified field. !(p) All fields can be expressed as a {@code long} integer. This method returns an object that describes the valid range for that value. !(p) 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. !(p) This method will return a result whether or not the chronology supports the field.
Resolves parsed {@code ChronoField} values into a date during parsing. !(p) Most {@code TemporalField} implementations are resolved using the resolve method on the field. By contrast, the {@code ChronoField} class defines fields that only have meaning relative to the chronology. As such, {@code ChronoField} date fields are resolved here _in the context of a specific chronology. !(p) The implementation, which explains typical resolve behaviour, is provided _in {@link AbstractChronology}.
Obtains a period for this chronology based on years, months and days. !(p) This returns a period tied to this chronology using the specified years, months and days. All supplied chronologies use periods based on years, months and days, however the {@code ChronoPeriod} API allows the period to be represented using other units.
Gets the number of seconds from the epoch of 1970-01-01T00:00:00Z. !(p) The number of seconds is calculated using the proleptic-year, month, day-of-month, hour, minute, second, and zoneOffset.
Gets the number of seconds from the epoch of 1970-01-01T00:00:00Z. !(p) The number of seconds is calculated using the era, year-of-era, month, day-of-month, hour, minute, second, and zoneOffset.
Compares this chronology to another chronology. !(p) The comparison order first by the chronology ID string, then by any additional information specific to the subclass. It is "consistent with equals", as defined by {@link Comparable}.
A hash code for this chronology. !(p) The hash code should be based on the entire state of the object.
Outputs this chronology as a {@code string}. !(p) The format should include the entire state of the object.