Top Description Constructors Methods
org.threeten.extra.chrono

pack-priv abstract Class AbstractDate

extends Object
implements ChronoLocalDate
Class Inheritance
All Implemented Interfaces
java.time.chrono.ChronoLocalDate, java.lang.Comparable, java.time.temporal.TemporalAdjuster, java.time.temporal.Temporal, java.time.temporal.TemporalAccessor
Known Direct Subclasses
org.threeten.extra.chrono.AbstractNileDate, org.threeten.extra.chrono.AccountingDate, org.threeten.extra.chrono.BritishCutoverDate, org.threeten.extra.chrono.DiscordianDate, org.threeten.extra.chrono.InternationalFixedDate, org.threeten.extra.chrono.JulianDate, org.threeten.extra.chrono.PaxDate, org.threeten.extra.chrono.Symmetry010Date, org.threeten.extra.chrono.Symmetry454Date
Static Imports
java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH, .ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR, .ChronoField.ALIGNED_WEEK_OF_MONTH, .ChronoField.ALIGNED_WEEK_OF_YEAR, .ChronoField.ERA, .ChronoField.YEAR

An abstract date based on a year, month and day.

Implementation Requirements

Implementations must be immutable and thread-safe.

Constructor Summary

AccessConstructor and Description
pack-priv
AbstractDate()

Creates an instance.

Method Summary

Modifier and TypeMethod and Description
pack-priv long
pack-priv ChronoPeriod
public boolean

Returns:

true if this is equal to the other date
equals
(Object
the object to check, null returns false
obj
)

Overrides java.lang.Object.equals.

Implements java.time.chrono.ChronoLocalDate.equals.

Compares this date to another date, including the chronology.

pack-priv int
pack-priv int
pack-priv int
pack-priv int
pack-priv abstract int
pack-priv int
pack-priv abstract int
public long
getLong(TemporalField
the field to get, not null
field
)

Implements java.time.temporal.TemporalAccessor.getLong.

Gets the value of the specified field as a long.

pack-priv abstract int
pack-priv long
pack-priv abstract int
pack-priv int
public int

Returns:

a suitable hash code based only on the Chronology and the date
hashCode
()

Overrides java.lang.Object.hashCode.

Implements java.time.chrono.ChronoLocalDate.hashCode.

A hash code for this date.

pack-priv int
pack-priv int
pack-priv long
public AbstractDate
plus(long
the amount of the specified unit to add, may be negative
amountToAdd
,
TemporalUnit
the unit of the amount to add, not null
unit
)

Overrides default java.time.chrono.ChronoLocalDate.plus.

Returns an object of the same type as this object with the specified period added.

pack-priv AbstractDate
plusDays(long days)

pack-priv AbstractDate
plusMonths(long months)

pack-priv AbstractDate
plusWeeks(long amountToAdd)

pack-priv AbstractDate
plusYears(long yearsToAdd)

public ValueRange
range(TemporalField
the field to query the range for, not null
field
)

Overrides default java.time.temporal.TemporalAccessor.range.

Gets the range of valid values for the specified field.

pack-priv abstract ValueRange
pack-priv ValueRange
pack-priv AbstractDate
resolveEpochDay(long epochDay)

pack-priv abstract AbstractDate
resolvePrevious(int newYear, int newMonth, int dayOfMonth)

public String
toString()

Overrides java.lang.Object.toString.

Implements java.time.chrono.ChronoLocalDate.toString.

Outputs this date as a String.

pack-priv long
pack-priv long
public AbstractDate
with(TemporalField
the field to set in the result, not null
field
,
long
the new value of the field in the result
newValue
)

Overrides default java.time.chrono.ChronoLocalDate.with.

Returns an object of the same type as this object with the specified field altered.

pack-priv AbstractDate
withDayOfYear(int value)

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Constructor Detail

AbstractDateback to summary
pack-priv AbstractDate()

Creates an instance.

Method Detail

daysUntilback to summary
pack-priv long daysUntil(ChronoLocalDate end)
doUntilback to summary
pack-priv ChronoPeriod doUntil(AbstractDate end)
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Implements java.time.chrono.ChronoLocalDate.equals.

Compares this date to another date, including the chronology.

Compares this date with another ensuring that the date is the same.

Only objects of this concrete type are compared, other types return false. To compare the dates of two TemporalAccessor instances, including dates in two different chronologies, use ChronoField#EPOCH_DAY as a comparator.

Parameters
obj:Object

the object to check, null returns false

Returns:boolean

true if this is equal to the other date

Annotations
@Override
getAlignedDayOfWeekInMonthback to summary
pack-priv int getAlignedDayOfWeekInMonth()
getAlignedDayOfWeekInYearback to summary
pack-priv int getAlignedDayOfWeekInYear()
getAlignedWeekOfMonthback to summary
pack-priv int getAlignedWeekOfMonth()
getAlignedWeekOfYearback to summary
pack-priv int getAlignedWeekOfYear()
getDayOfMonthback to summary
pack-priv abstract int getDayOfMonth()
getDayOfWeekback to summary
pack-priv int getDayOfWeek()
getDayOfYearback to summary
pack-priv abstract int getDayOfYear()
getLongback to summary
public long getLong(TemporalField field)

Implements java.time.temporal.TemporalAccessor.getLong.

Doc from java.time.temporal.TemporalAccessor.getLong.

Gets the value of the specified field as a long.

This queries the date-time for the value of the specified field. The returned value may be outside the valid range of values for the field. If the date-time cannot return the value, because the field is unsupported or for some other reason, an exception will be thrown.

Parameters
field:TemporalField

the field to get, not null

Returns:long

the value for the field

Annotations
@Override
getMonthback to summary
pack-priv abstract int getMonth()
getProlepticMonthback to summary
pack-priv long getProlepticMonth()
getProlepticYearback to summary
pack-priv abstract int getProlepticYear()
getYearOfEraback to summary
pack-priv int getYearOfEra()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Implements java.time.chrono.ChronoLocalDate.hashCode.

A hash code for this date.

Returns:int

a suitable hash code based only on the Chronology and the date

Annotations
@Override
lengthOfWeekback to summary
pack-priv int lengthOfWeek()
lengthOfYearInMonthsback to summary
pack-priv int lengthOfYearInMonths()
monthsUntilback to summary
pack-priv long monthsUntil(AbstractDate end)
plusback to summary
public AbstractDate plus(long amountToAdd, TemporalUnit unit)

Overrides default java.time.chrono.ChronoLocalDate.plus.

Doc from java.time.chrono.ChronoLocalDate.plus.

Returns an object of the same type as this object with the specified period added.

This method returns a new object based on this one with the specified period added. For example, on a LocalDate, this could be used to add a number of years, months or days. The returned object will have the same observable type as this object.

In some cases, changing a field is not fully defined. For example, if the target object is a date representing the 31st January, then adding one month would be unclear. In cases like this, the field is responsible for resolving the result. Typically it will choose the previous valid date, which would be the last valid day of February in this example.

Parameters
amountToAdd:long

Doc from java.time.temporal.Temporal.plus.

the amount of the specified unit to add, may be negative

unit:TemporalUnit

Doc from java.time.temporal.Temporal.plus.

the unit of the amount to add, not null

Returns:AbstractDate

Doc from java.time.temporal.Temporal.plus.

an object of the same type with the specified period added, not null

Annotations
@Override
plusDaysback to summary
pack-priv AbstractDate plusDays(long days)
plusMonthsback to summary
pack-priv AbstractDate plusMonths(long months)
plusWeeksback to summary
pack-priv AbstractDate plusWeeks(long amountToAdd)
plusYearsback to summary
pack-priv AbstractDate plusYears(long yearsToAdd)
rangeback to summary
public ValueRange range(TemporalField field)

Overrides default java.time.temporal.TemporalAccessor.range.

Doc from java.time.temporal.TemporalAccessor.range.

Gets the range of valid values for the specified field.

All fields can be expressed as a long integer. This method returns an object that describes the valid range for that value. The value of this temporal object is used to enhance the accuracy of the returned range. If the date-time cannot return the range, because the field is unsupported or for some other reason, an exception will be thrown.

Note that the result only describes the minimum and maximum valid values and it is important not to read too much into them. For example, there could be values within the range that are invalid for the field.

Parameters
field:TemporalField

the field to query the range for, not null

Returns:ValueRange

the range of valid values for the field, not null

Annotations
@Override
rangeAlignedWeekOfMonthback to summary
pack-priv abstract ValueRange rangeAlignedWeekOfMonth()
rangeChronoback to summary
pack-priv ValueRange rangeChrono(ChronoField field)
resolveEpochDayback to summary
pack-priv AbstractDate resolveEpochDay(long epochDay)
resolvePreviousback to summary
pack-priv abstract AbstractDate resolvePrevious(int newYear, int newMonth, int dayOfMonth)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Implements java.time.chrono.ChronoLocalDate.toString.

Doc from java.time.chrono.ChronoLocalDate.toString.

Outputs this date as a String.

The output will include the full local date.

Returns:String

the formatted date, not null

Annotations
@Override
untilback to summary
pack-priv long until(AbstractDate end, TemporalUnit unit)
weeksUntilback to summary
pack-priv long weeksUntil(AbstractDate end)
withback to summary
public AbstractDate with(TemporalField field, long newValue)

Overrides default java.time.chrono.ChronoLocalDate.with.

Doc from java.time.chrono.ChronoLocalDate.with.

Returns an object of the same type as this object with the specified field altered.

This returns a new object based on this one with the value for the specified field changed. For example, on a LocalDate, this could be used to set the year, month or day-of-month. The returned object will have the same observable type as this object.

In some cases, changing a field is not fully defined. For example, if the target object is a date representing the 31st January, then changing the month to February would be unclear. In cases like this, the field is responsible for resolving the result. Typically it will choose the previous valid date, which would be the last valid day of February in this example.

Parameters
field:TemporalField

Doc from java.time.temporal.Temporal.with.

the field to set in the result, not null

newValue:long

Doc from java.time.temporal.Temporal.with.

the new value of the field in the result

Returns:AbstractDate

Doc from java.time.temporal.Temporal.with.

an object of the same type with the specified field set, not null

Annotations
@Override
withDayOfYearback to summary
pack-priv AbstractDate withDayOfYear(int value)