Class EastAsianMonth
- All Implemented Interfaces:
Serializable
,Comparable<EastAsianMonth>
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 Summary
Modifier and TypeFieldDescriptionstatic AttributeKey<Character>
Format attribute which defines a symbol character for the leap month deviating from standard.static AttributeKey<Boolean>
Format attribute which defines if the symbol character for the leap month should be printed after the month (default isfalse
for most languages). -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo(EastAsianMonth other)
boolean
getDisplayName(Locale locale, NumberSystem numsys)
Obtains a mainly numeric representation of this month for display purposes.int
Gets the corresponding numerical value which is not necessarily unique due to a possible leap month flag.getOldJapaneseName(Locale locale)
Gets the traditional Japanese month name.int
hashCode()
boolean
isLeap()
Is this month a lunisolar leap month?toString()
static EastAsianMonth
valueOf(int month)
Gets the standard East Asian month which corresponds to the given numerical value.withLeap()
Obtains the leap month version of this month.
-
Field Details
-
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.
-
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.
- Since:
- 3.40/4.35
- See Also:
ChronoFormatter.with(AttributeKey, boolean)
,LEAP_MONTH_INDICATOR
-
-
Method Details
-
valueOf
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
Obtains the leap month version of this month.
- Returns:
- east asian leap month with the same number as this month
-
getOldJapaneseName
Gets the traditional Japanese month name.
Note: The leap month flag is ignored.
- Parameters:
locale
- language setting- Returns:
- descriptive text (never
null
)
-
getDisplayName
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 settingnumsys
- number system- Returns:
- descriptive text (never
null
)
-
compareTo
- Specified by:
compareTo
in interfaceComparable<EastAsianMonth>
-
equals
-
hashCode
public int hashCode() -
toString
-