Class Chronology
- java.lang.Object
-
- javax.time.calendar.Chronology
-
- All Implemented Interfaces:
Calendrical
- Direct Known Subclasses:
CopticChronology
,HistoricChronology
,ISOChronology
,JulianChronology
public abstract class Chronology extends Object implements Calendrical
A calendar system, consisting of rules controlling the passage of human-scale time.Calendar systems describe a set of fields that can be used to describe time in a human-scale. Typical fields include year, month-of-year and day-of-month.
This abstract base class provides a common mechanism to access the standard fields which are supported in the vast majority of calendar systems. Subclasses will provide the full set of fields for that calendar system.
The default chronology is
ISO8601
which is the de facto world calendar today.Chronology is an abstract class and must be implemented with care to ensure other classes in the framework operate correctly. All instantiable subclasses must be final, immutable and thread-safe. Wherever possible subclasses should be singletons with no public constructor. It is recommended that subclasses implement
Serializable
- Author:
- Stephen Colebourne
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Chronology()
Restrictive constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <T> T
get(CalendricalRule<T> rule)
Gets the value of the specified calendrical rule.abstract String
getName()
Gets the name of the chronology.static CalendricalRule<Chronology>
rule()
Gets the rule forChronology
.String
toString()
Returns a textual description of the chronology.
-
-
-
Method Detail
-
getName
public abstract String getName()
Gets the name of the chronology.The name should not have the suffix 'Chronology'. For example, the name of
ISOChronology
is 'ISO'.- Returns:
- the name of the chronology, never null
-
toString
public String toString()
Returns a textual description of the chronology.
-
get
public <T> T get(CalendricalRule<T> rule)
Gets the value of the specified calendrical rule.This method queries the value of the specified calendrical rule. If the value cannot be returned for the rule from this offset then
null
will be returned.- Specified by:
get
in interfaceCalendrical
- Parameters:
rule
- the rule to use, not null- Returns:
- the value for the rule, null if the value cannot be returned
-
rule
public static CalendricalRule<Chronology> rule()
Gets the rule forChronology
.- Returns:
- the rule for the chronology, never null
-
-