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.
| Modifier and Type | Field and Description |
|---|---|
static AttributeKey<Character> |
LEAP_MONTH_INDICATOR
Format attribute which defines a symbol character for the leap month deviating from standard.
|
static AttributeKey<Boolean> |
LEAP_MONTH_IS_TRAILING
Format attribute which defines if the symbol character for the leap month should be printed
after the month (default is
false for most languages). |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(EastAsianMonth other) |
boolean |
equals(Object obj) |
String |
getDisplayName(Locale locale,
NumberSystem numsys)
Obtains a mainly numeric representation of this month for display purposes.
|
int |
getNumber()
Gets the corresponding numerical value which is not necessarily unique due to a possible
leap month flag.
|
String |
getOldJapaneseName(Locale locale)
Gets the traditional Japanese month name.
|
int |
hashCode() |
boolean |
isLeap()
Is this month a lunisolar leap month?
|
String |
toString() |
static EastAsianMonth |
valueOf(int month)
Gets the standard East Asian month which corresponds to the given numerical value.
|
EastAsianMonth |
withLeap()
Obtains the leap month version of this month.
|
public static final AttributeKey<Character> LEAP_MONTH_INDICATOR
Format attribute which defines a symbol character for the leap month deviating from standard.
This attribute is only relevant for the numeric formatting of leap months.
public static final AttributeKey<Boolean> LEAP_MONTH_IS_TRAILING
Format attribute which defines if the symbol character for the leap month should be printed
after the month (default is false for most languages).
This attribute is only relevant for the numeric formatting of leap months.
ChronoFormatter.with(AttributeKey, boolean),
LEAP_MONTH_INDICATORpublic 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.
month - standard month in the range [1-12]IllegalArgumentException - if given argument is out of rangepublic 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.
isLeap()public boolean isLeap()
Is this month a lunisolar leap month?
public EastAsianMonth withLeap()
Obtains the leap month version of this month.
public String getOldJapaneseName(Locale locale)
Gets the traditional Japanese month name.
Note: The leap month flag is ignored.
locale - language settingnull)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.
locale - language settingnumsys - number systemnull)public int compareTo(EastAsianMonth other)
compareTo in interface Comparable<EastAsianMonth>Copyright © 2014–2021. All rights reserved.