Class EastAsianMonth

java.lang.Object
net.time4j.calendar.EastAsianMonth
All Implemented Interfaces:
Serializable, Comparable<EastAsianMonth>

public final class EastAsianMonth extends Object implements Comparable<EastAsianMonth>, Serializable

Represents a month used in the East Asian countries China, Japan, Korea or Vietnam.

This kind of month has its origins in the Chinese calendar. It is defined within the lunisolar context and sometimes allows a leap month. Such a leap month happens about every 2-3 years and has the same number as the preceding one. Therefore it is important not to leave out the leap month flag before a month number if such a month has to be printed.

However, in Japan, the East Asian month is identical to the gregorian month since Meiji 6 (1873) and does no longer make usage of any leap months.

Since:
3.32/4.27
Author:
Meno Hochschild
See Also:
Serialized Form
  • Field Details

  • Method Details

    • valueOf

      public static EastAsianMonth valueOf(int month)

      Gets the standard East Asian month which corresponds to the given numerical value.

      Users have to invoke the method withLeap() in order to obtain a leap month.

      Parameters:
      month - standard month in the range [1-12]
      Returns:
      east asian month as wrapper around a number
      Throws:
      IllegalArgumentException - if given argument is out of range
    • getNumber

      public int getNumber()

      Gets the corresponding numerical value which is not necessarily unique due to a possible leap month flag.

      Lunisolar leap months have the same number as the preceding month.

      Returns:
      number of month in the range [1-12]
      See Also:
      isLeap()
    • isLeap

      public boolean isLeap()

      Is this month a lunisolar leap month?

      Returns:
      boolean
    • withLeap

      public EastAsianMonth withLeap()

      Obtains the leap month version of this month.

      Returns:
      east asian leap month with the same number as this month
    • getOldJapaneseName

      public String getOldJapaneseName(Locale locale)

      Gets the traditional Japanese month name.

      Note: The leap month flag is ignored.

      Parameters:
      locale - language setting
      Returns:
      descriptive text (never null)
    • getDisplayName

      public String getDisplayName(Locale locale, NumberSystem numsys)

      Obtains a mainly numeric representation of this month for display purposes.

      East Asian months are traditionally displayed in a numeric way. Example:

            EastAsianMonth month = EastAsianMonth.valueOf(1).withLeap();
            String s = month.getDisplayName(Locale.ENGLISH, NumberSystem.ARABIC);
            System.out.println(s); // output with leap-indicator "i": i1
       

      The leap indicator is locale-sensitive. Time4J uses the asterisk as default, but for the major European languages with some affinity to Latin also the small letter "i" (intercalary). The East Asian languages Chinese (閏), Japanese (閏), Korean (윤) and Vietnamese (n) have their own special characters.

      Parameters:
      locale - language setting
      numsys - number system
      Returns:
      descriptive text (never null)
    • compareTo

      public int compareTo(EastAsianMonth other)
      Specified by:
      compareTo in interface Comparable<EastAsianMonth>
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object