Class BaseChronology
- java.lang.Object
 - 
- org.joda.time.Chronology
 - 
- org.joda.time.chrono.BaseChronology
 
 
 
- 
- All Implemented Interfaces:
 java.io.Serializable
- Direct Known Subclasses:
 AssembledChronology
public abstract class BaseChronology extends Chronology implements java.io.Serializable
BaseChronology provides a skeleton implementation for chronology classes. Many utility methods are defined, but all fields are unsupported.BaseChronology is thread-safe and immutable, and all subclasses must be as well.
- Since:
 - 1.0
 - See Also:
 - Serialized Form
 
 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description longadd(long instant, long duration, int scalar)Adds the duration to the instant, specifying the number of times to add.longadd(ReadablePeriod period, long instant, int scalar)Adds the period to the instant, specifying the number of times to add.DurationFieldcenturies()Get the centuries duration field for this chronology.DateTimeFieldcenturyOfEra()Get the century of era field for this chronology.DateTimeFieldclockhourOfDay()Get the hour of day (offset to 1-24) field for this chronology.DateTimeFieldclockhourOfHalfday()Get the hour of am/pm (offset to 1-12) field for this chronology.DateTimeFielddayOfMonth()Get the day of month field for this chronology.DateTimeFielddayOfWeek()Get the day of week field for this chronology.DateTimeFielddayOfYear()Get the day of year field for this chronology.DurationFielddays()Get the days duration field for this chronology.DateTimeFieldera()Get the era field for this chronology.DurationFielderas()Get the eras duration field for this chronology.int[]get(ReadablePartial partial, long instant)Gets the values of a partial from an instant.int[]get(ReadablePeriod period, long duration)Gets the values of a period from an interval.int[]get(ReadablePeriod period, long startInstant, long endInstant)Gets the values of a period from an interval.longgetDateTimeMillis(int year, int monthOfYear, int dayOfMonth, int millisOfDay)Returns a datetime millisecond instant, formed from the given year, month, day, and millisecond values.longgetDateTimeMillis(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.longgetDateTimeMillis(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.abstract DateTimeZonegetZone()Returns the DateTimeZone that this Chronology operates in, or null if unspecified.DateTimeFieldhalfdayOfDay()Get the AM(0) PM(1) field for this chronology.DurationFieldhalfdays()Get the halfdays duration field for this chronology.DateTimeFieldhourOfDay()Get the hour of day (0-23) field for this chronology.DateTimeFieldhourOfHalfday()Get the hour of am/pm (0-11) field for this chronology.DurationFieldhours()Get the hours duration field for this chronology.DurationFieldmillis()Get the millis duration field for this chronology.DateTimeFieldmillisOfDay()Get the millis of day field for this chronology.DateTimeFieldmillisOfSecond()Get the millis of second field for this chronology.DateTimeFieldminuteOfDay()Get the minute of day field for this chronology.DateTimeFieldminuteOfHour()Get the minute of hour field for this chronology.DurationFieldminutes()Get the minutes duration field for this chronology.DateTimeFieldmonthOfYear()Get the month of year field for this chronology.DurationFieldmonths()Get the months duration field for this chronology.DateTimeFieldsecondOfDay()Get the second of day field for this chronology.DateTimeFieldsecondOfMinute()Get the second of minute field for this chronology.DurationFieldseconds()Get the seconds duration field for this chronology.longset(ReadablePartial partial, long instant)Sets the partial into the instant.abstract java.lang.StringtoString()Gets a debugging toString.voidvalidate(ReadablePartial partial, int[] values)Validates whether the fields stored in a partial instant are valid.DateTimeFieldweekOfWeekyear()Get the week of a week based year field for this chronology.DurationFieldweeks()Get the weeks duration field for this chronology.DateTimeFieldweekyear()Get the year of a week based year field for this chronology.DateTimeFieldweekyearOfCentury()Get the year of a week based year in a century field for this chronology.DurationFieldweekyears()Get the weekyears duration field for this chronology.abstract ChronologywithUTC()Returns an instance of this Chronology that operates in the UTC time zone.abstract ChronologywithZone(DateTimeZone zone)Returns an instance of this Chronology that operates in any time zone.DateTimeFieldyear()Get the year field for this chronology.DateTimeFieldyearOfCentury()Get the year of century field for this chronology.DateTimeFieldyearOfEra()Get the year of era field for this chronology.DurationFieldyears()Get the years duration field for this chronology. 
 - 
 
- 
- 
Method Detail
- 
getZone
public abstract DateTimeZone getZone()
Returns the DateTimeZone that this Chronology operates in, or null if unspecified.- Specified by:
 getZonein classChronology- Returns:
 - DateTimeZone null if unspecified
 
 
- 
withUTC
public abstract Chronology withUTC()
Returns an instance of this Chronology that operates in the UTC time zone. Chronologies that do not operate in a time zone or are already UTC must return themself.- Specified by:
 withUTCin classChronology- Returns:
 - a version of this chronology that ignores time zones
 
 
- 
withZone
public abstract Chronology withZone(DateTimeZone zone)
Returns an instance of this Chronology that operates in any time zone.- Specified by:
 withZonein classChronology- Parameters:
 zone- to use, or default if null- Returns:
 - a version of this chronology with a specific time zone
 - See Also:
 ZonedChronology
 
- 
getDateTimeMillis
public long getDateTimeMillis(int year, int monthOfYear, int dayOfMonth, int millisOfDay) throws java.lang.IllegalArgumentExceptionReturns 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.
- Specified by:
 getDateTimeMillisin classChronology- 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.IllegalArgumentExceptionReturns 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.
- Specified by:
 getDateTimeMillisin classChronology- 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.IllegalArgumentExceptionReturns 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.
- Specified by:
 getDateTimeMillisin classChronology- 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
 
- 
validate
public void validate(ReadablePartial partial, int[] values)
Validates whether the fields stored in a partial instant are valid.This implementation uses
DateTimeField.getMinimumValue(ReadablePartial, int[])andDateTimeField.getMaximumValue(ReadablePartial, int[]).- Specified by:
 validatein classChronology- Parameters:
 partial- the partial instant to validatevalues- the values to validate, not null unless the partial is empty- Throws:
 java.lang.IllegalArgumentException- if the instant is invalid
 
- 
get
public int[] get(ReadablePartial partial, long instant)
Gets the values of a partial from an instant.- Specified by:
 getin classChronology- Parameters:
 partial- the partial instant to useinstant- the instant to query- Returns:
 - the values of the partial extracted from the instant
 
 
- 
set
public long set(ReadablePartial partial, long instant)
Sets the partial into the instant.- Specified by:
 setin classChronology- Parameters:
 partial- the partial instant to useinstant- the instant to update- Returns:
 - the updated instant
 
 
- 
get
public int[] get(ReadablePeriod period, long startInstant, long endInstant)
Gets the values of a period from an interval.- Specified by:
 getin classChronology- Parameters:
 period- the period instant to usestartInstant- the start instant of an interval to queryendInstant- the start instant of an interval to query- Returns:
 - the values of the period extracted from the interval
 
 
- 
get
public int[] get(ReadablePeriod period, long duration)
Gets the values of a period from an interval.- Specified by:
 getin classChronology- Parameters:
 period- the period instant to useduration- the duration to query- Returns:
 - the values of the period extracted from the duration
 
 
- 
add
public long add(ReadablePeriod period, long instant, int scalar)
Adds the period to the instant, specifying the number of times to add.- Specified by:
 addin classChronology- Parameters:
 period- the period to add, null means add nothinginstant- the instant to add toscalar- the number of times to add- Returns:
 - the updated instant
 
 
- 
add
public long add(long instant, long duration, int scalar)Adds the duration to the instant, specifying the number of times to add.- Specified by:
 addin classChronology- Parameters:
 instant- the instant to add toduration- the duration to addscalar- the number of times to add- Returns:
 - the updated instant
 
 
- 
millis
public DurationField millis()
Get the millis duration field for this chronology.- Specified by:
 millisin classChronology- Returns:
 - DurationField or UnsupportedDurationField if unsupported
 
 
- 
millisOfSecond
public DateTimeField millisOfSecond()
Get the millis of second field for this chronology.- Specified by:
 millisOfSecondin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
millisOfDay
public DateTimeField millisOfDay()
Get the millis of day field for this chronology.- Specified by:
 millisOfDayin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
seconds
public DurationField seconds()
Get the seconds duration field for this chronology.- Specified by:
 secondsin classChronology- Returns:
 - DurationField or UnsupportedDurationField if unsupported
 
 
- 
secondOfMinute
public DateTimeField secondOfMinute()
Get the second of minute field for this chronology.- Specified by:
 secondOfMinutein classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
secondOfDay
public DateTimeField secondOfDay()
Get the second of day field for this chronology.- Specified by:
 secondOfDayin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
minutes
public DurationField minutes()
Get the minutes duration field for this chronology.- Specified by:
 minutesin classChronology- Returns:
 - DurationField or UnsupportedDurationField if unsupported
 
 
- 
minuteOfHour
public DateTimeField minuteOfHour()
Get the minute of hour field for this chronology.- Specified by:
 minuteOfHourin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
minuteOfDay
public DateTimeField minuteOfDay()
Get the minute of day field for this chronology.- Specified by:
 minuteOfDayin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
hours
public DurationField hours()
Get the hours duration field for this chronology.- Specified by:
 hoursin classChronology- Returns:
 - DurationField or UnsupportedDurationField if unsupported
 
 
- 
hourOfDay
public DateTimeField hourOfDay()
Get the hour of day (0-23) field for this chronology.- Specified by:
 hourOfDayin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
clockhourOfDay
public DateTimeField clockhourOfDay()
Get the hour of day (offset to 1-24) field for this chronology.- Specified by:
 clockhourOfDayin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
halfdays
public DurationField halfdays()
Get the halfdays duration field for this chronology.- Specified by:
 halfdaysin classChronology- Returns:
 - DurationField or UnsupportedDurationField if unsupported
 
 
- 
hourOfHalfday
public DateTimeField hourOfHalfday()
Get the hour of am/pm (0-11) field for this chronology.- Specified by:
 hourOfHalfdayin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
clockhourOfHalfday
public DateTimeField clockhourOfHalfday()
Get the hour of am/pm (offset to 1-12) field for this chronology.- Specified by:
 clockhourOfHalfdayin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
halfdayOfDay
public DateTimeField halfdayOfDay()
Get the AM(0) PM(1) field for this chronology.- Specified by:
 halfdayOfDayin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
days
public DurationField days()
Get the days duration field for this chronology.- Specified by:
 daysin classChronology- Returns:
 - DurationField or UnsupportedDurationField if unsupported
 
 
- 
dayOfWeek
public DateTimeField dayOfWeek()
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.- Specified by:
 dayOfWeekin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
dayOfMonth
public DateTimeField dayOfMonth()
Get the day of month field for this chronology.- Specified by:
 dayOfMonthin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
dayOfYear
public DateTimeField dayOfYear()
Get the day of year field for this chronology.- Specified by:
 dayOfYearin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
weeks
public DurationField weeks()
Get the weeks duration field for this chronology.- Specified by:
 weeksin classChronology- Returns:
 - DurationField or UnsupportedDurationField if unsupported
 
 
- 
weekOfWeekyear
public DateTimeField weekOfWeekyear()
Get the week of a week based year field for this chronology.- Specified by:
 weekOfWeekyearin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
weekyears
public DurationField weekyears()
Get the weekyears duration field for this chronology.- Specified by:
 weekyearsin classChronology- Returns:
 - DurationField or UnsupportedDurationField if unsupported
 
 
- 
weekyear
public DateTimeField weekyear()
Get the year of a week based year field for this chronology.- Specified by:
 weekyearin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
weekyearOfCentury
public DateTimeField weekyearOfCentury()
Get the year of a week based year in a century field for this chronology.- Specified by:
 weekyearOfCenturyin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
months
public DurationField months()
Get the months duration field for this chronology.- Specified by:
 monthsin classChronology- Returns:
 - DurationField or UnsupportedDurationField if unsupported
 
 
- 
monthOfYear
public DateTimeField monthOfYear()
Get the month of year field for this chronology.- Specified by:
 monthOfYearin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
years
public DurationField years()
Get the years duration field for this chronology.- Specified by:
 yearsin classChronology- Returns:
 - DurationField or UnsupportedDurationField if unsupported
 
 
- 
year
public DateTimeField year()
Get the year field for this chronology.- Specified by:
 yearin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
yearOfEra
public DateTimeField yearOfEra()
Get the year of era field for this chronology.- Specified by:
 yearOfErain classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
yearOfCentury
public DateTimeField yearOfCentury()
Get the year of century field for this chronology.- Specified by:
 yearOfCenturyin classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
centuries
public DurationField centuries()
Get the centuries duration field for this chronology.- Specified by:
 centuriesin classChronology- Returns:
 - DurationField or UnsupportedDurationField if unsupported
 
 
- 
centuryOfEra
public DateTimeField centuryOfEra()
Get the century of era field for this chronology.- Specified by:
 centuryOfErain classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
eras
public DurationField eras()
Get the eras duration field for this chronology.- Specified by:
 erasin classChronology- Returns:
 - DurationField or UnsupportedDurationField if unsupported
 
 
- 
era
public DateTimeField era()
Get the era field for this chronology.- Specified by:
 erain classChronology- Returns:
 - DateTimeField or UnsupportedDateTimeField if unsupported
 
 
- 
toString
public abstract java.lang.String toString()
Gets a debugging toString.- Specified by:
 toStringin classChronology- Returns:
 - a debugging string
 
 
 - 
 
 -