javax.time.i18n
Interface Era

All Known Implementing Classes:
CopticEra

public interface Era

An 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.

For example, the Gregorian calendar system divides time into AD and BC. By contrast, the Japanese calendar system has one era per Emperor.

This interface provides basic type safety on top of eras in different calendar systems. It is normally implemented by an enum. An implementation of Era may be shared between different calendar systems if appropriate.

Instances of this class may be created from other date objects that implement Calendrical. Notably this includes LocalDate and all other date classes from other calendar systems.

This interface must be implemented with care to ensure other classes in the framework operate correctly. All implementations that can be instantiated must be final, immutable, thread-safe and singleton. It is strongly recommended to use an enum.

Author:
Stephen Colebourne

Method Summary
 int getValue()
          Gets the numeric value associated with the era as defined by the chronology.
 

Method Detail

getValue

int getValue()
Gets the numeric value associated with the era as defined by the chronology.

Within the Time Framework for Java, all fields are allocated a numerical value. The meaning of the value for era is determined by the chronology according to these principles:

The era in use at 1970-01-01 has the value 1. Later eras have sequentially higher values. Earlier eras have sequentially lower values. Each chronology should have constants providing meaning to the era value.

For example, the Gregorian chronology uses AD/BC, with AD being 1 and BC being 0.

Returns:
the numerical era value, within the valid range for the chronology