Class AssembledChronology
- java.lang.Object
-
- org.joda.time.Chronology
-
- org.joda.time.chrono.BaseChronology
-
- org.joda.time.chrono.AssembledChronology
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
BasicChronology
,BuddhistChronology
,GJChronology
,ISOChronology
,LenientChronology
,LimitChronology
,StrictChronology
,ZonedChronology
public abstract class AssembledChronology extends BaseChronology
Abstract Chronology that enables chronologies to be assembled from a container of fields.AssembledChronology is thread-safe and immutable.
- Since:
- 1.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AssembledChronology.Fields
A container of fields used for assembling a chronology.
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protected
AssembledChronology(Chronology base, java.lang.Object param)
Constructor calls the assemble method, enabling subclasses to define its supported fields.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
assemble(AssembledChronology.Fields fields)
Invoked by the constructor and after deserialization to allow subclasses to define all of its supported fields.DurationField
centuries()
Get the centuries duration field for this chronology.DateTimeField
centuryOfEra()
Get the century of era field for this chronology.DateTimeField
clockhourOfDay()
Get the hour of day (offset to 1-24) field for this chronology.DateTimeField
clockhourOfHalfday()
Get the hour of am/pm (offset to 1-12) field for this chronology.DateTimeField
dayOfMonth()
Get the day of month field for this chronology.DateTimeField
dayOfWeek()
Get the day of week field for this chronology.DateTimeField
dayOfYear()
Get the day of year field for this chronology.DurationField
days()
Get the days duration field for this chronology.DateTimeField
era()
Get the era field for this chronology.DurationField
eras()
Get the eras duration field for this chronology.protected Chronology
getBase()
Returns the same base chronology as passed into the constructor.long
getDateTimeMillis(int year, int monthOfYear, int dayOfMonth, int millisOfDay)
Returns a datetime millisecond instant, formed from the given year, month, day, and millisecond values.long
getDateTimeMillis(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
Returns a datetime millisecond instant, formed from the given year, month, day, hour, minute, second, and millisecond values.long
getDateTimeMillis(long instant, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
Returns a datetime millisecond instant, from from the given instant, hour, minute, second, and millisecond values.protected java.lang.Object
getParam()
Returns the same param object as passed into the constructor.DateTimeZone
getZone()
Returns the DateTimeZone that this Chronology operates in, or null if unspecified.DateTimeField
halfdayOfDay()
Get the AM(0) PM(1) field for this chronology.DurationField
halfdays()
Get the halfdays duration field for this chronology.DateTimeField
hourOfDay()
Get the hour of day (0-23) field for this chronology.DateTimeField
hourOfHalfday()
Get the hour of am/pm (0-11) field for this chronology.DurationField
hours()
Get the hours duration field for this chronology.DurationField
millis()
Get the millis duration field for this chronology.DateTimeField
millisOfDay()
Get the millis of day field for this chronology.DateTimeField
millisOfSecond()
Get the millis of second field for this chronology.DateTimeField
minuteOfDay()
Get the minute of day field for this chronology.DateTimeField
minuteOfHour()
Get the minute of hour field for this chronology.DurationField
minutes()
Get the minutes duration field for this chronology.DateTimeField
monthOfYear()
Get the month of year field for this chronology.DurationField
months()
Get the months duration field for this chronology.private void
readObject(java.io.ObjectInputStream in)
DateTimeField
secondOfDay()
Get the second of day field for this chronology.DateTimeField
secondOfMinute()
Get the second of minute field for this chronology.DurationField
seconds()
Get the seconds duration field for this chronology.private void
setFields()
DateTimeField
weekOfWeekyear()
Get the week of a week based year field for this chronology.DurationField
weeks()
Get the weeks duration field for this chronology.DateTimeField
weekyear()
Get the year of a week based year field for this chronology.DateTimeField
weekyearOfCentury()
Get the year of a week based year in a century field for this chronology.DurationField
weekyears()
Get the weekyears duration field for this chronology.DateTimeField
year()
Get the year field for this chronology.DateTimeField
yearOfCentury()
Get the year of century field for this chronology.DateTimeField
yearOfEra()
Get the year of era field for this chronology.DurationField
years()
Get the years duration field for this chronology.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
iBase
private final Chronology iBase
-
iParam
private final java.lang.Object iParam
-
iMillis
private transient DurationField iMillis
-
iSeconds
private transient DurationField iSeconds
-
iMinutes
private transient DurationField iMinutes
-
iHours
private transient DurationField iHours
-
iHalfdays
private transient DurationField iHalfdays
-
iDays
private transient DurationField iDays
-
iWeeks
private transient DurationField iWeeks
-
iWeekyears
private transient DurationField iWeekyears
-
iMonths
private transient DurationField iMonths
-
iYears
private transient DurationField iYears
-
iCenturies
private transient DurationField iCenturies
-
iEras
private transient DurationField iEras
-
iMillisOfSecond
private transient DateTimeField iMillisOfSecond
-
iMillisOfDay
private transient DateTimeField iMillisOfDay
-
iSecondOfMinute
private transient DateTimeField iSecondOfMinute
-
iSecondOfDay
private transient DateTimeField iSecondOfDay
-
iMinuteOfHour
private transient DateTimeField iMinuteOfHour
-
iMinuteOfDay
private transient DateTimeField iMinuteOfDay
-
iHourOfDay
private transient DateTimeField iHourOfDay
-
iClockhourOfDay
private transient DateTimeField iClockhourOfDay
-
iHourOfHalfday
private transient DateTimeField iHourOfHalfday
-
iClockhourOfHalfday
private transient DateTimeField iClockhourOfHalfday
-
iHalfdayOfDay
private transient DateTimeField iHalfdayOfDay
-
iDayOfWeek
private transient DateTimeField iDayOfWeek
-
iDayOfMonth
private transient DateTimeField iDayOfMonth
-
iDayOfYear
private transient DateTimeField iDayOfYear
-
iWeekOfWeekyear
private transient DateTimeField iWeekOfWeekyear
-
iWeekyear
private transient DateTimeField iWeekyear
-
iWeekyearOfCentury
private transient DateTimeField iWeekyearOfCentury
-
iMonthOfYear
private transient DateTimeField iMonthOfYear
-
iYear
private transient DateTimeField iYear
-
iYearOfEra
private transient DateTimeField iYearOfEra
-
iYearOfCentury
private transient DateTimeField iYearOfCentury
-
iCenturyOfEra
private transient DateTimeField iCenturyOfEra
-
iEra
private transient DateTimeField iEra
-
iBaseFlags
private transient int iBaseFlags
-
-
Constructor Detail
-
AssembledChronology
protected AssembledChronology(Chronology base, java.lang.Object param)
Constructor calls the assemble method, enabling subclasses to define its supported fields. If a base chronology is supplied, the field set initially contains references to each base chronology field.Other methods in this class will delegate to the base chronology, if it can be determined that the base chronology will produce the same results as AbstractChronology.
- Parameters:
base
- optional base chronology to copy initial fields fromparam
- optional param object available for assemble method
-
-
Method Detail
-
getZone
public DateTimeZone getZone()
Description copied from class:BaseChronology
Returns the DateTimeZone that this Chronology operates in, or null if unspecified.- Specified by:
getZone
in classBaseChronology
- Returns:
- DateTimeZone null if unspecified
-
getDateTimeMillis
public long getDateTimeMillis(int year, int monthOfYear, int dayOfMonth, int millisOfDay) throws java.lang.IllegalArgumentException
Description copied from class:BaseChronology
Returns a datetime millisecond instant, formed from the given year, month, day, and millisecond values. The set of given values must refer to a valid datetime, or else an IllegalArgumentException is thrown.The default implementation calls upon separate DateTimeFields to determine the result. Subclasses are encouraged to provide a more efficient implementation.
- Overrides:
getDateTimeMillis
in classBaseChronology
- Parameters:
year
- year to usemonthOfYear
- month to usedayOfMonth
- day of month to usemillisOfDay
- millisecond to use- Returns:
- millisecond instant from 1970-01-01T00:00:00Z
- Throws:
java.lang.IllegalArgumentException
- if the values are invalid
-
getDateTimeMillis
public long getDateTimeMillis(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond) throws java.lang.IllegalArgumentException
Description copied from class:BaseChronology
Returns a datetime millisecond instant, formed from the given year, month, day, hour, minute, second, and millisecond values. The set of given values must refer to a valid datetime, or else an IllegalArgumentException is thrown.The default implementation calls upon separate DateTimeFields to determine the result. Subclasses are encouraged to provide a more efficient implementation.
- Overrides:
getDateTimeMillis
in classBaseChronology
- Parameters:
year
- year to usemonthOfYear
- month to usedayOfMonth
- day of month to usehourOfDay
- hour to useminuteOfHour
- minute to usesecondOfMinute
- second to usemillisOfSecond
- millisecond to use- Returns:
- millisecond instant from 1970-01-01T00:00:00Z
- Throws:
java.lang.IllegalArgumentException
- if the values are invalid
-
getDateTimeMillis
public long getDateTimeMillis(long instant, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond) throws java.lang.IllegalArgumentException
Description copied from class:BaseChronology
Returns a datetime millisecond instant, from from the given instant, hour, minute, second, and millisecond values. The set of given values must refer to a valid datetime, or else an IllegalArgumentException is thrown.The default implementation calls upon separate DateTimeFields to determine the result. Subclasses are encouraged to provide a more efficient implementation.
- Overrides:
getDateTimeMillis
in classBaseChronology
- Parameters:
instant
- instant to start fromhourOfDay
- hour to useminuteOfHour
- minute to usesecondOfMinute
- second to usemillisOfSecond
- millisecond to use- Returns:
- millisecond instant from 1970-01-01T00:00:00Z
- Throws:
java.lang.IllegalArgumentException
- if the values are invalid
-
millis
public final DurationField millis()
Description copied from class:BaseChronology
Get the millis duration field for this chronology.- Overrides:
millis
in classBaseChronology
- Returns:
- DurationField or UnsupportedDurationField if unsupported
-
millisOfSecond
public final DateTimeField millisOfSecond()
Description copied from class:BaseChronology
Get the millis of second field for this chronology.- Overrides:
millisOfSecond
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
millisOfDay
public final DateTimeField millisOfDay()
Description copied from class:BaseChronology
Get the millis of day field for this chronology.- Overrides:
millisOfDay
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
seconds
public final DurationField seconds()
Description copied from class:BaseChronology
Get the seconds duration field for this chronology.- Overrides:
seconds
in classBaseChronology
- Returns:
- DurationField or UnsupportedDurationField if unsupported
-
secondOfMinute
public final DateTimeField secondOfMinute()
Description copied from class:BaseChronology
Get the second of minute field for this chronology.- Overrides:
secondOfMinute
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
secondOfDay
public final DateTimeField secondOfDay()
Description copied from class:BaseChronology
Get the second of day field for this chronology.- Overrides:
secondOfDay
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
minutes
public final DurationField minutes()
Description copied from class:BaseChronology
Get the minutes duration field for this chronology.- Overrides:
minutes
in classBaseChronology
- Returns:
- DurationField or UnsupportedDurationField if unsupported
-
minuteOfHour
public final DateTimeField minuteOfHour()
Description copied from class:BaseChronology
Get the minute of hour field for this chronology.- Overrides:
minuteOfHour
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
minuteOfDay
public final DateTimeField minuteOfDay()
Description copied from class:BaseChronology
Get the minute of day field for this chronology.- Overrides:
minuteOfDay
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
hours
public final DurationField hours()
Description copied from class:BaseChronology
Get the hours duration field for this chronology.- Overrides:
hours
in classBaseChronology
- Returns:
- DurationField or UnsupportedDurationField if unsupported
-
hourOfDay
public final DateTimeField hourOfDay()
Description copied from class:BaseChronology
Get the hour of day (0-23) field for this chronology.- Overrides:
hourOfDay
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
clockhourOfDay
public final DateTimeField clockhourOfDay()
Description copied from class:BaseChronology
Get the hour of day (offset to 1-24) field for this chronology.- Overrides:
clockhourOfDay
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
halfdays
public final DurationField halfdays()
Description copied from class:BaseChronology
Get the halfdays duration field for this chronology.- Overrides:
halfdays
in classBaseChronology
- Returns:
- DurationField or UnsupportedDurationField if unsupported
-
hourOfHalfday
public final DateTimeField hourOfHalfday()
Description copied from class:BaseChronology
Get the hour of am/pm (0-11) field for this chronology.- Overrides:
hourOfHalfday
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
clockhourOfHalfday
public final DateTimeField clockhourOfHalfday()
Description copied from class:BaseChronology
Get the hour of am/pm (offset to 1-12) field for this chronology.- Overrides:
clockhourOfHalfday
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
halfdayOfDay
public final DateTimeField halfdayOfDay()
Description copied from class:BaseChronology
Get the AM(0) PM(1) field for this chronology.- Overrides:
halfdayOfDay
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
days
public final DurationField days()
Description copied from class:BaseChronology
Get the days duration field for this chronology.- Overrides:
days
in classBaseChronology
- Returns:
- DurationField or UnsupportedDurationField if unsupported
-
dayOfWeek
public final DateTimeField dayOfWeek()
Description copied from class:BaseChronology
Get the day of week field for this chronology.DayOfWeek values are defined in
DateTimeConstants
. They use the ISO definitions, where 1 is Monday and 7 is Sunday.- Overrides:
dayOfWeek
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
dayOfMonth
public final DateTimeField dayOfMonth()
Description copied from class:BaseChronology
Get the day of month field for this chronology.- Overrides:
dayOfMonth
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
dayOfYear
public final DateTimeField dayOfYear()
Description copied from class:BaseChronology
Get the day of year field for this chronology.- Overrides:
dayOfYear
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
weeks
public final DurationField weeks()
Description copied from class:BaseChronology
Get the weeks duration field for this chronology.- Overrides:
weeks
in classBaseChronology
- Returns:
- DurationField or UnsupportedDurationField if unsupported
-
weekOfWeekyear
public final DateTimeField weekOfWeekyear()
Description copied from class:BaseChronology
Get the week of a week based year field for this chronology.- Overrides:
weekOfWeekyear
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
weekyears
public final DurationField weekyears()
Description copied from class:BaseChronology
Get the weekyears duration field for this chronology.- Overrides:
weekyears
in classBaseChronology
- Returns:
- DurationField or UnsupportedDurationField if unsupported
-
weekyear
public final DateTimeField weekyear()
Description copied from class:BaseChronology
Get the year of a week based year field for this chronology.- Overrides:
weekyear
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
weekyearOfCentury
public final DateTimeField weekyearOfCentury()
Description copied from class:BaseChronology
Get the year of a week based year in a century field for this chronology.- Overrides:
weekyearOfCentury
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
months
public final DurationField months()
Description copied from class:BaseChronology
Get the months duration field for this chronology.- Overrides:
months
in classBaseChronology
- Returns:
- DurationField or UnsupportedDurationField if unsupported
-
monthOfYear
public final DateTimeField monthOfYear()
Description copied from class:BaseChronology
Get the month of year field for this chronology.- Overrides:
monthOfYear
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
years
public final DurationField years()
Description copied from class:BaseChronology
Get the years duration field for this chronology.- Overrides:
years
in classBaseChronology
- Returns:
- DurationField or UnsupportedDurationField if unsupported
-
year
public final DateTimeField year()
Description copied from class:BaseChronology
Get the year field for this chronology.- Overrides:
year
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
yearOfEra
public final DateTimeField yearOfEra()
Description copied from class:BaseChronology
Get the year of era field for this chronology.- Overrides:
yearOfEra
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
yearOfCentury
public final DateTimeField yearOfCentury()
Description copied from class:BaseChronology
Get the year of century field for this chronology.- Overrides:
yearOfCentury
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
centuries
public final DurationField centuries()
Description copied from class:BaseChronology
Get the centuries duration field for this chronology.- Overrides:
centuries
in classBaseChronology
- Returns:
- DurationField or UnsupportedDurationField if unsupported
-
centuryOfEra
public final DateTimeField centuryOfEra()
Description copied from class:BaseChronology
Get the century of era field for this chronology.- Overrides:
centuryOfEra
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
eras
public final DurationField eras()
Description copied from class:BaseChronology
Get the eras duration field for this chronology.- Overrides:
eras
in classBaseChronology
- Returns:
- DurationField or UnsupportedDurationField if unsupported
-
era
public final DateTimeField era()
Description copied from class:BaseChronology
Get the era field for this chronology.- Overrides:
era
in classBaseChronology
- Returns:
- DateTimeField or UnsupportedDateTimeField if unsupported
-
assemble
protected abstract void assemble(AssembledChronology.Fields fields)
Invoked by the constructor and after deserialization to allow subclasses to define all of its supported fields. All unset fields default to unsupported instances.- Parameters:
fields
- container of fields
-
getBase
protected final Chronology getBase()
Returns the same base chronology as passed into the constructor.
-
getParam
protected final java.lang.Object getParam()
Returns the same param object as passed into the constructor.
-
setFields
private void setFields()
-
readObject
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
-