- java.lang.Object
-
- java.lang.Enum<AccountingEra>
-
- org.threeten.extra.chrono.AccountingEra
-
- All Implemented Interfaces:
Serializable
,Comparable<AccountingEra>
,Era
,TemporalAccessor
,TemporalAdjuster
public enum AccountingEra extends Enum<AccountingEra> implements Era
An era in the Accounting calendar system.The Accounting calendar system has two eras. The current era, for years from 1 onwards, is known as the 'Current Era'. All previous years, zero or earlier in the proleptic count or one and greater in the year-of-era count, are part of the 'Before Current Era' era.
The start of accounting epochs
0001-01-01 (Accounting)
will vary against the ISO calendar. Depending on options chosen, it can start as early as0000-01-26 (ISO)
or as late as0001-01-04 (ISO)
.Do not use
ordinal()
to obtain the numeric representation ofAccountingEra
. UsegetValue()
instead.Implementation Requirements:
This is an immutable and thread-safe enum.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getValue()
Gets the numeric eraint
value.static AccountingEra
of(int era)
Obtains an instance ofAccountingEra
from anint
value.static AccountingEra
valueOf(String name)
Returns the enum constant of this type with the specified name.static AccountingEra[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.-
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Methods inherited from interface java.time.chrono.Era
adjustInto, get, getDisplayName, getLong, isSupported, query, range
-
-
-
-
Enum Constant Detail
-
BCE
public static final AccountingEra BCE
The singleton instance for the era before the current one, 'Before Current Era', which has the numeric value 0.
-
CE
public static final AccountingEra CE
The singleton instance for the current era, 'Current Era', which has the numeric value 1.
-
-
Method Detail
-
values
public static AccountingEra[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (AccountingEra c : AccountingEra.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static AccountingEra valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
of
public static AccountingEra of(int era)
Obtains an instance ofAccountingEra
from anint
value.AccountingEra
is an enum representing the Accounting eras of BCE/CE. This factory allows the enum to be obtained from theint
value.- Parameters:
era
- the BCE/CE value to represent, from 0 (BCE) to 1 (CE)- Returns:
- the era singleton, not null
- Throws:
DateTimeException
- if the value is invalid
-
-