< prev index next >

src/java.base/share/classes/java/time/chrono/IsoEra.java

Print this page




  53  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  54  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  55  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  56  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  57  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  58  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  59  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  60  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  61  */
  62 package java.time.chrono;
  63 
  64 import java.time.DateTimeException;
  65 
  66 /**
  67  * An era in the ISO calendar system.
  68  * <p>
  69  * The ISO-8601 standard does not define eras.
  70  * A definition has therefore been created with two eras - 'Current era' (CE) for
  71  * years on or after 0001-01-01 (ISO), and 'Before current era' (BCE) for years before that.
  72  *
  73  * <table class="striped">
  74  * <caption style="display:none">ISO years and eras</caption>
  75  * <thead>
  76  * <tr>
  77  * <th style="text-align:left">year-of-era</th>
  78  * <th style="text-align:left">era</th>
  79  * <th style="text-align:left">proleptic-year</th>
  80  * </tr>
  81  * </thead>
  82  * <tbody>
  83  * <tr>
  84  * <td>2</td><td>CE</td><td>2</td>
  85  * </tr>
  86  * <tr>
  87  * <td>1</td><td>CE</td><td>1</td>
  88  * </tr>
  89  * <tr>
  90  * <td>1</td><td>BCE</td><td>0</td>
  91  * </tr>
  92  * <tr>
  93  * <td>2</td><td>BCE</td><td>-1</td>
  94  * </tr>
  95  * </tbody>
  96  * </table>
  97  * <p>
  98  * <b>Do not use {@code ordinal()} to obtain the numeric representation of {@code IsoEra}.
  99  * Use {@code getValue()} instead.</b>
 100  *
 101  * @implSpec
 102  * This is an immutable and thread-safe enum.
 103  *
 104  * @since 1.8
 105  */
 106 public enum IsoEra implements Era {
 107 
 108     /**
 109      * The singleton instance for the era before the current one, 'Before Current Era',
 110      * which has the numeric value 0.
 111      */
 112     BCE,
 113     /**




  53  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  54  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  55  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  56  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  57  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  58  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  59  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  60  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  61  */
  62 package java.time.chrono;
  63 
  64 import java.time.DateTimeException;
  65 
  66 /**
  67  * An era in the ISO calendar system.
  68  * <p>
  69  * The ISO-8601 standard does not define eras.
  70  * A definition has therefore been created with two eras - 'Current era' (CE) for
  71  * years on or after 0001-01-01 (ISO), and 'Before current era' (BCE) for years before that.
  72  *
  73  * <table class="striped" style="text-align:left">
  74  * <caption style="display:none">ISO years and eras</caption>
  75  * <thead>
  76  * <tr>
  77  * <th scope="col">year-of-era</th>
  78  * <th scope="col">era</th>
  79  * <th scope="col">proleptic-year</th>
  80  * </tr>
  81  * </thead>
  82  * <tbody>
  83  * <tr>
  84  * <td>2</td><td>CE</td><th scope="row">2</th>
  85  * </tr>
  86  * <tr>
  87  * <td>1</td><td>CE</td><th scope="row">1</th>
  88  * </tr>
  89  * <tr>
  90  * <td>1</td><td>BCE</td><th scope="row">0</th>
  91  * </tr>
  92  * <tr>
  93  * <td>2</td><td>BCE</td><th scope="row">-1</th>
  94  * </tr>
  95  * </tbody>
  96  * </table>
  97  * <p>
  98  * <b>Do not use {@code ordinal()} to obtain the numeric representation of {@code IsoEra}.
  99  * Use {@code getValue()} instead.</b>
 100  *
 101  * @implSpec
 102  * This is an immutable and thread-safe enum.
 103  *
 104  * @since 1.8
 105  */
 106 public enum IsoEra implements Era {
 107 
 108     /**
 109      * The singleton instance for the era before the current one, 'Before Current Era',
 110      * which has the numeric value 0.
 111      */
 112     BCE,
 113     /**


< prev index next >