public final class ChronoHistory
extends java.lang.Object
implements java.io.Serializable
Represents the chronological history of calendar reforms in a given region.
| Modifier and Type | Field and Description |
|---|---|
static AttributeKey<java.lang.Boolean> |
ATTRIBUTE_COMMON_ERA
Format attribute which prefers the notation of "Common Era" in formatting
an enum of type
HistoricEra. |
static AttributeKey<PlainDate> |
ATTRIBUTE_CUTOVER_DATE
Format attribute which can cause the format engine to create a chronological history with
given cutover date.
|
static AttributeKey<HistoricVariant> |
ATTRIBUTE_HISTORIC_VARIANT
Format attribute which determines the historical calendar variant.
|
static AttributeKey<java.lang.Boolean> |
ATTRIBUTE_LATIN_ERA
Format attribute which enforces latin notations of historic eras ignoring the locale.
|
static ChronoHistory |
PROLEPTIC_GREGORIAN
Describes no real historical event but just the proleptic gregorian calendar which is assumed
to be in power all times.
|
static ChronoHistory |
PROLEPTIC_JULIAN
Describes no real historical event but just the proleptic julian calendar which is assumed
to be in power all times.
|
| Modifier and Type | Method and Description |
|---|---|
PlainDate |
convert(HistoricDate date)
Converts given historical date to an ISO-8601-date.
|
HistoricDate |
convert(PlainDate date)
Converts given ISO-8601-date to a historical date.
|
TextElement<java.lang.Integer> |
dayOfMonth()
Defines the element for the historical day of month.
|
boolean |
equals(java.lang.Object obj) |
TextElement<HistoricEra> |
era()
Defines the element for the historical era.
|
java.util.Set<ChronoElement<?>> |
getElements()
Yields all associated elements.
|
PlainDate |
getGregorianCutOverDate()
Yields the date of final introduction of gregorian calendar.
|
int |
getLengthOfYear(HistoricEra era,
int yearOfEra)
Determines the length of given historical year in days.
|
HistoricVariant |
getVariant()
Yields the variant.
|
int |
hashCode() |
boolean |
isValid(HistoricDate date)
Is given historical date valid?
|
TextElement<java.lang.Integer> |
month()
Defines the element for the historical month.
|
static ChronoHistory |
of(java.util.Locale locale)
Determines the history of gregorian calendar reforms for given locale.
|
static ChronoHistory |
ofFirstGregorianReform()
Describes the original switch from julian to gregorian calendar introduced
by pope Gregor on 1582-10-15.
|
static ChronoHistory |
ofGregorianReform(PlainDate start)
Describes a single switch from julian to gregorian calendar at given date.
|
static ChronoHistory |
ofSweden()
The Swedish calendar has three cutover dates due to a failed experiment
when switching to gregorian calendar in the years 1700-1712 step by step.
|
java.lang.String |
toString() |
TextElement<java.lang.Integer> |
yearOfEra()
Defines the element for the year of a given historical era.
|
public static final AttributeKey<HistoricVariant> ATTRIBUTE_HISTORIC_VARIANT
Format attribute which determines the historical calendar variant.
Users will usually not directly use this attribute but adjust a given ChronoFormatter
by its method with(ChronoHistory).
ChronoFormatter.with(ChronoHistory)public static final AttributeKey<PlainDate> ATTRIBUTE_CUTOVER_DATE
Format attribute which can cause the format engine to create a chronological history with given cutover date.
Users will usually not directly use this attribute but adjust a given ChronoFormatter
by its method withGregorianCutOver().
public static final AttributeKey<java.lang.Boolean> ATTRIBUTE_COMMON_ERA
Format attribute which prefers the notation of "Common Era" in formatting
an enum of type HistoricEra.
Users will usually not directly use this attribute but call the method
ChronoFormatter.withAlternativeEraNames() instead.
public static final AttributeKey<java.lang.Boolean> ATTRIBUTE_LATIN_ERA
Format attribute which enforces latin notations of historic eras ignoring the locale.
Users will usually not directly use this attribute but call the method
ChronoFormatter.withLatinEraNames() instead.
ChronoFormatter.withLatinEraNames()public static final ChronoHistory PROLEPTIC_GREGORIAN
Describes no real historical event but just the proleptic gregorian calendar which is assumed to be in power all times.
This constant rather serves for academic purposes. Users will normally use PlainDate
without an era.
public static final ChronoHistory PROLEPTIC_JULIAN
Describes no real historical event but just the proleptic julian calendar which is assumed to be in power all times.
This constant rather serves for academic purposes because the julian calendar is now nowhere in power and has not existed before the calendar reform of Julius Caesar.
public static ChronoHistory ofFirstGregorianReform()
Describes the original switch from julian to gregorian calendar introduced by pope Gregor on 1582-10-15.
ofGregorianReform(PlainDate)public static ChronoHistory ofGregorianReform(PlainDate start)
Describes a single switch from julian to gregorian calendar at given date.
Since version 3.1 there are two special cases to consider. If the given date is the maximum/minimum
of the date axis then this method will return the proleptic julian/gregorian ChronoHistory.
start - calendar date when the gregorian calendar was introducedjava.lang.IllegalArgumentException - if given date is before first introduction of gregorian calendar on 1582-10-15ofFirstGregorianReform()public static ChronoHistory of(java.util.Locale locale)
Determines the history of gregorian calendar reforms for given locale.
The actual implementation just falls back to the introduction of gregorian calendar by
pope Gregor - with the exception of Russia, Sweden and England. Later releases of Time4J will
refine the implementation for most European countries. For any cutover date not supported by this
method, users can call ofGregorianReform(PlainDate) instead.
This method does not use the language part of given locale but the country part (ISO-3166).
locale - country settingofGregorianReform(PlainDate)public static ChronoHistory ofSweden()
The Swedish calendar has three cutover dates due to a failed experiment when switching to gregorian calendar in the years 1700-1712 step by step.
public boolean isValid(HistoricDate date)
Is given historical date valid?
If the argument is null then this method returns false.
date - historical calendar date to be checked, maybe nullfalse if given date is invalid else truepublic PlainDate convert(HistoricDate date)
Converts given historical date to an ISO-8601-date.
date - historical calendar datejava.lang.IllegalArgumentException - if given date is invalidpublic HistoricDate convert(PlainDate date)
Converts given ISO-8601-date to a historical date.
date - ISO-8601-date (gregorian)public HistoricVariant getVariant()
Yields the variant.
public PlainDate getGregorianCutOverDate()
Yields the date of final introduction of gregorian calendar.
public int getLengthOfYear(HistoricEra era, int yearOfEra)
Determines the length of given historical year in days.
era - historical erayearOfEra - historical year of era-1 if the length cannot be determinedpublic TextElement<HistoricEra> era()
Defines the element for the historical era.
This element is applicable on all chronological types which have registered the element
PlainDate.COMPONENT.
PlainDate,
PlainTimestamppublic TextElement<java.lang.Integer> yearOfEra()
Defines the element for the year of a given historical era.
This element is applicable on all chronological types which have registered the element
PlainDate.COMPONENT.
PlainDate,
PlainTimestamppublic TextElement<java.lang.Integer> month()
Defines the element for the historical month.
This element is applicable on all chronological types which have registered the element
PlainDate.COMPONENT.
PlainDate,
PlainTimestamppublic TextElement<java.lang.Integer> dayOfMonth()
Defines the element for the historical day of month.
This element is applicable on all chronological types which have registered the element
PlainDate.COMPONENT.
PlainDate,
PlainTimestamppublic java.util.Set<ChronoElement<?>> getElements()
Yields all associated elements.
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object