< 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 summary="ISO years and eras" cellpadding="2" cellspacing="3" border="0" >

  74  * <thead>
  75  * <tr class="tableSubHeadingColor">
  76  * <th class="colFirst" style="text-align:left">year-of-era</th>
  77  * <th class="colFirst" style="text-align:left">era</th>
  78  * <th class="colLast" style="text-align:left">proleptic-year</th>
  79  * </tr>
  80  * </thead>
  81  * <tbody>
  82  * <tr class="rowColor">
  83  * <td>2</td><td>CE</td><td>2</td>
  84  * </tr>
  85  * <tr class="altColor">
  86  * <td>1</td><td>CE</td><td>1</td>
  87  * </tr>
  88  * <tr class="rowColor">
  89  * <td>1</td><td>BCE</td><td>0</td>
  90  * </tr>
  91  * <tr class="altColor">
  92  * <td>2</td><td>BCE</td><td>-1</td>
  93  * </tr>
  94  * </tbody>
  95  * </table>
  96  * <p>
  97  * <b>Do not use {@code ordinal()} to obtain the numeric representation of {@code IsoEra}.
  98  * Use {@code getValue()} instead.</b>
  99  *
 100  * @implSpec
 101  * This is an immutable and thread-safe enum.
 102  *
 103  * @since 1.8
 104  */
 105 public enum IsoEra implements Era {
 106 
 107     /**
 108      * The singleton instance for the era before the current one, 'Before Current Era',
 109      * which has the numeric value 0.
 110      */
 111     BCE,




  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,


< prev index next >