Module java.base

Class MinguoChronology

  • All Implemented Interfaces:
    Serializable, Comparable<Chronology>, Chronology

    public final class MinguoChronology
    extends AbstractChronology
    implements Serializable
    The Minguo calendar system.

    This chronology defines the rules of the Minguo calendar system. This calendar system is primarily used in the Republic of China, often known as Taiwan. Dates are aligned such that 0001-01-01 (Minguo) is 1912-01-01 (ISO).

    The fields are defined as follows:

    • era - There are two eras, the current 'Republic' (ERA_ROC) and the previous era (ERA_BEFORE_ROC).
    • year-of-era - The year-of-era for the current era increases uniformly from the epoch at year one. For the previous era the year increases from one as time goes backwards. The value for the current era is equal to the ISO proleptic-year minus 1911.
    • proleptic-year - The proleptic year is the same as the year-of-era for the current era. For the previous era, years have zero, then negative values. The value is equal to the ISO proleptic-year minus 1911.
    • month-of-year - The Minguo month-of-year exactly matches ISO.
    • day-of-month - The Minguo day-of-month exactly matches ISO.
    • day-of-year - The Minguo day-of-year exactly matches ISO.
    • leap-year - The Minguo leap-year pattern exactly matches ISO, such that the two calendars are never out of step.

    Implementation Requirements:
    This class is immutable and thread-safe.
    Since:
    1.8
    See Also:
    Serialized Form
    • Field Detail

      • INSTANCE

        public static final MinguoChronology INSTANCE
        Singleton instance for the Minguo chronology.
    • Method Detail

      • getId

        public String getId()
        Gets the ID of the chronology - 'Minguo'.

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

        Specified by:
        getId in interface Chronology
        Returns:
        the chronology ID - 'Minguo'
        See Also:
        getCalendarType()
      • getCalendarType

        public String getCalendarType()
        Gets the calendar type of the underlying calendar system - 'roc'.

        The calendar type is an identifier defined by the Unicode Locale Data Markup Language (LDML) specification. It can be used to lookup the Chronology using Chronology.of(String). It can also be used as part of a locale, accessible via Locale.getUnicodeLocaleType(String) with the key 'ca'.

        Specified by:
        getCalendarType in interface Chronology
        Returns:
        the calendar system type - 'roc'
        See Also:
        getId()
      • date

        public MinguoDate date​(Era era,
                               int yearOfEra,
                               int month,
                               int dayOfMonth)
        Obtains a local date in Minguo calendar system from the era, year-of-era, month-of-year and day-of-month fields.
        Specified by:
        date in interface Chronology
        Parameters:
        era - the Minguo era, not null
        yearOfEra - the year-of-era
        month - the month-of-year
        dayOfMonth - the day-of-month
        Returns:
        the Minguo local date, not null
        Throws:
        DateTimeException - if unable to create the date
        ClassCastException - if the era is not a MinguoEra
      • date

        public MinguoDate date​(int prolepticYear,
                               int month,
                               int dayOfMonth)
        Obtains a local date in Minguo calendar system from the proleptic-year, month-of-year and day-of-month fields.
        Specified by:
        date in interface Chronology
        Parameters:
        prolepticYear - the proleptic-year
        month - the month-of-year
        dayOfMonth - the day-of-month
        Returns:
        the Minguo local date, not null
        Throws:
        DateTimeException - if unable to create the date
      • dateYearDay

        public MinguoDate dateYearDay​(Era era,
                                      int yearOfEra,
                                      int dayOfYear)
        Obtains a local date in Minguo calendar system from the era, year-of-era and day-of-year fields.
        Specified by:
        dateYearDay in interface Chronology
        Parameters:
        era - the Minguo era, not null
        yearOfEra - the year-of-era
        dayOfYear - the day-of-year
        Returns:
        the Minguo local date, not null
        Throws:
        DateTimeException - if unable to create the date
        ClassCastException - if the era is not a MinguoEra
      • dateYearDay

        public MinguoDate dateYearDay​(int prolepticYear,
                                      int dayOfYear)
        Obtains a local date in Minguo calendar system from the proleptic-year and day-of-year fields.
        Specified by:
        dateYearDay in interface Chronology
        Parameters:
        prolepticYear - the proleptic-year
        dayOfYear - the day-of-year
        Returns:
        the Minguo local date, not null
        Throws:
        DateTimeException - if unable to create the date
      • dateEpochDay

        public MinguoDate dateEpochDay​(long epochDay)
        Obtains a local date in the Minguo calendar system from the epoch-day.
        Specified by:
        dateEpochDay in interface Chronology
        Parameters:
        epochDay - the epoch day
        Returns:
        the Minguo local date, not null
        Throws:
        DateTimeException - if unable to create the date
      • isLeapYear

        public boolean isLeapYear​(long prolepticYear)
        Checks if the specified year is a leap year.

        Minguo leap years occur exactly in line with ISO leap years. This method does not validate the year passed in, and only has a well-defined result for years in the supported range.

        Specified by:
        isLeapYear in interface Chronology
        Parameters:
        prolepticYear - the proleptic-year to check, not validated for range
        Returns:
        true if the year is a leap year