public enum JapaneseEra extends java.lang.Enum<JapaneseEra> implements Calendrical
Do not use ordinal() to obtain the numeric representation of a JapaneseEra instance. Use getValue() instead.
JapaneseEra is immutable and thread-safe.
Enum Constant and Description |
---|
HEISEI
The singleton instance for the Heisei era (1989-01-08 - current)
which has the value 2.
|
KEIO
The singleton instance for the Keio era (1865-04-07 - 1868-09-07)
which has the value -2.
|
MEIJI
The singleton instance for the Meiji era (1868-09-08 - 1912-07-29)
which has the value -1.
|
SHOWA
The singleton instance for the Showa era (1926-12-25 - 1989-01-07)
which has the value 1.
|
TAISHO
The singleton instance for the Taisho era (1912-07-30 - 1926-12-24)
which has the value 0.
|
UNKNOWN
The singleton instance for the before Keio era ( - 1865-04-06)
which has the value -3.
|
Modifier and Type | Method and Description |
---|---|
static JapaneseEra |
from(Calendrical calendrical)
Obtains an instance of
JapaneseEra from a calendrical. |
<T> T |
get(CalendricalRule<T> rule)
Gets the value of the specified calendrical rule.
|
int |
getValue()
Gets the era numeric value.
|
int |
getYearOffset()
Returns year offset in the era.
|
static JapaneseEra |
of(int japaneseEra)
Obtains an instance of
JapaneseEra from a value. |
static DateTimeFieldRule<JapaneseEra> |
rule()
Gets the rule that defines how the era field operates.
|
static JapaneseEra |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static JapaneseEra[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final JapaneseEra UNKNOWN
public static final JapaneseEra KEIO
public static final JapaneseEra MEIJI
public static final JapaneseEra TAISHO
public static final JapaneseEra SHOWA
public static final JapaneseEra HEISEI
public static JapaneseEra[] values()
for (JapaneseEra c : JapaneseEra.values()) System.out.println(c);
public static JapaneseEra valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static DateTimeFieldRule<JapaneseEra> rule()
The rule provides access to the minimum and maximum values, and a generic way to access values within a calendrical.
public static JapaneseEra of(int japaneseEra)
JapaneseEra
from a value.
The SHOWA era that contains 1970-01-01 (ISO calendar system) has the value 1 Later era is numbered 2 (HEISEI). Earlier eras are numbered 0 (TAISHO), -1 (MEIJI), -2 (KEIO), -3 (UNKNOWN), only Keio and later eras are supported.
japaneseEra
- the era to represent, from -3 to 2IllegalCalendarFieldValueException
- if the era is invalidpublic static JapaneseEra from(Calendrical calendrical)
JapaneseEra
from a calendrical.
This can be used extract the era directly from any implementation of Calendrical, including those in other calendar systems.
calendrical
- the calendrical to extract from, not nullUnsupportedRuleException
- if the era cannot be obtainedpublic <T> T get(CalendricalRule<T> rule)
This method queries the value of the specified calendrical rule.
If the value cannot be returned for the rule from this instance then
null
will be returned.
get
in interface Calendrical
rule
- the rule to use, not nullpublic int getValue()
The SHOWA era that contains 1970-01-01 (ISO calendar system) has the value 1 Later eras are numbered 2 (HEISEI). Earlier eras are numbered 0 (TAISHO), -1 (MEIJI), -2 (KEIO).
public int getYearOffset()