- All Known Implementing Classes:
public interface Era extends TemporalAccessor, TemporalAdjusterAn era of the time-line.
Most calendar systems have a single epoch dividing the time-line into two eras. However, some calendar systems, have multiple eras, such as one for the reign of each leader. In all cases, the era is conceptually the largest division of the time-line. Each chronology defines the Era's that are known Eras and a
Chrono.erasto get the valid eras.
For example, the Thai Buddhist calendar system divides time into two eras, before and after a single date. By contrast, the Japanese calendar system has one era for the reign of each Emperor.
Eramay be compared using the
Specification for implementorsThis interface must be implemented with care to ensure other classes operate correctly. All implementations must be singletons - final, immutable and thread-safe. It is recommended to use an enum whenever possible.
All Methods Instance Methods Abstract Methods Modifier and Type Method Description
getDisplayName(TextStyle style, java.util.Locale locale)Gets the textual representation of this era.
getValue()Gets the numeric value associated with the era as defined by the chronology.
Methods inherited from interface org.threeten.bp.temporal.TemporalAccessor
get, getLong, isSupported, query, range
int getValue()Gets the numeric value associated with the era as defined by the chronology. Each chronology defines the predefined Eras and methods to list the Eras of the chronology.
All fields, including eras, have an associated numeric value. The meaning of the numeric value for era is determined by the chronology according to these principles:
- The era in use at the epoch 1970-01-01 (ISO) has the value 1.
- Later eras have sequentially higher values.
- Earlier eras have sequentially lower values, which may be negative.
- the numeric era value
java.lang.String getDisplayName(TextStyle style, java.util.Locale locale)Gets the textual representation of this era.
This returns the textual name used to identify the era. The parameters control the style of the returned text and the locale.
If no textual mapping is found then the
numeric valueis returned.
style- the style of the text required, not null
locale- the locale to use, not null
- the text value of the era, not null