final class JapaneseChronology extends Chronology with Serializable
The Japanese Imperial calendar system.
This chronology defines the rules of the Japanese Imperial calendar system. This calendar system is primarily used in Japan. The Japanese Imperial calendar system is the same as the ISO calendar system apart from the era-based year numbering.
Japan introduced the Gregorian calendar starting with Meiji 6. Only Meiji and later eras are supported; dates before Meiji 6, January 1 are not supported.
The supported ChronoField
instances are:
DAY_OF_WEEK
DAY_OF_MONTH
DAY_OF_YEAR
EPOCH_DAY
MONTH_OF_YEAR
PROLEPTIC_MONTH
YEAR_OF_ERA
YEAR
ERA
Specification for implementors
This class is immutable and thread-safe.
- Annotations
- @SerialVersionUID()
- Alphabetic
- By Inheritance
- JapaneseChronology
- Serializable
- Chronology
- Ordered
- Comparable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- def <(that: Chronology): Boolean
- Definition Classes
- Ordered
- def <=(that: Chronology): Boolean
- Definition Classes
- Ordered
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def >(that: Chronology): Boolean
- Definition Classes
- Ordered
- def >=(that: Chronology): Boolean
- Definition Classes
- Ordered
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def compare(other: Chronology): Int
Compares this chronology to another chronology.
Compares this chronology to another chronology.
The comparison order first by the chronology ID string, then by any additional information specific to the subclass. It is "consistent with equals", as defined by
Comparable
.The default implementation compares the chronology ID. Subclasses must compare any additional state that they store.
- other
the other chronology to compare to, not null
- returns
the comparator value, negative if less, positive if greater
- Definition Classes
- Chronology → Ordered
- def compareTo(that: Chronology): Int
- Definition Classes
- Ordered → Comparable
- def date(temporal: TemporalAccessor): JapaneseDate
Obtains a local date in this chronology from another temporal object.
Obtains a local date in this chronology from another temporal object.
This creates a date in this chronology based on the specified
TemporalAccessor
.The standard mechanism for conversion between date types is the
local epoch-day
field.- temporal
the temporal object to convert, not null
- returns
the local date in this chronology, not null
- Definition Classes
- JapaneseChronology → Chronology
- Exceptions thrown
DateTimeException
if unable to create the date
- def date(prolepticYear: Int, month: Int, dayOfMonth: Int): JapaneseDate
Obtains a local date in this chronology from the proleptic-year, month-of-year and day-of-month fields.
Obtains a local date in this chronology from the proleptic-year, month-of-year and day-of-month fields.
- prolepticYear
the chronology proleptic-year
- month
the chronology month-of-year
- dayOfMonth
the chronology day-of-month
- returns
the local date in this chronology, not null
- Definition Classes
- JapaneseChronology → Chronology
- Exceptions thrown
DateTimeException
if unable to create the date
- def date(era: Era, yearOfEra: Int, month: Int, dayOfMonth: Int): JapaneseDate
Obtains a local date in this chronology from the era, year-of-era, month-of-year and day-of-month fields.
Obtains a local date in this chronology from the era, year-of-era, month-of-year and day-of-month fields.
- era
the era of the correct type for the chronology, not null
- yearOfEra
the chronology year-of-era
- month
the chronology month-of-year
- dayOfMonth
the chronology day-of-month
- returns
the local date in this chronology, not null
- Definition Classes
- JapaneseChronology → Chronology
- Exceptions thrown
ClassCastException
if the { @code era} is not of the correct type for the chronologyDateTimeException
if unable to create the date
- def dateEpochDay(epochDay: Long): JapaneseDate
Obtains a local date in this chronology from the epoch-day.
Obtains a local date in this chronology from the epoch-day.
The definition of
EPOCH_DAY
is the same for all calendar systems, thus it can be used for conversion.- epochDay
the epoch day
- returns
the local date in this chronology, not null
- Definition Classes
- JapaneseChronology → Chronology
- Exceptions thrown
DateTimeException
if unable to create the date
- def dateNow(clock: Clock): JapaneseDate
Obtains the current local date in this chronology from the specified clock.
Obtains the current local date in this chronology from the specified clock.
This will query the specified clock to obtain the current date - today. Using this method allows the use of an alternate clock for testing. The alternate clock may be introduced using
dependency injection
.- clock
the clock to use, not null
- returns
the current local date, not null
- Definition Classes
- JapaneseChronology → Chronology
- Exceptions thrown
DateTimeException
if unable to create the date
- def dateNow(zone: ZoneId): JapaneseDate
Obtains the current local date in this chronology from the system clock in the specified time-zone.
Obtains the current local date in this chronology from the system clock in the specified time-zone.
This will query the
system clock
to obtain the current date. Specifying the time-zone avoids dependence on the default time-zone.Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.
- zone
the zone ID to use, not null
- returns
the current local date using the system clock, not null
- Definition Classes
- JapaneseChronology → Chronology
- Exceptions thrown
DateTimeException
if unable to create the date
- def dateNow: JapaneseDate
Obtains the current local date in this chronology from the system clock in the default time-zone.
Obtains the current local date in this chronology from the system clock in the default time-zone.
This will query the
system clock
in the default time-zone to obtain the current date.Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.
This implementation uses
#dateNow(Clock)
.- returns
the current local date using the system clock and default time-zone, not null
- Definition Classes
- JapaneseChronology → Chronology
- Exceptions thrown
DateTimeException
if unable to create the date
- def dateYearDay(prolepticYear: Int, dayOfYear: Int): JapaneseDate
Obtains a local date in Japanese calendar system from the proleptic-year and day-of-year fields.
Obtains a local date in Japanese calendar system from the proleptic-year and day-of-year fields.
The day-of-year in this factory is expressed relative to the start of the proleptic year. The Japanese proleptic year and day-of-year are the same as those in the ISO calendar system. They are not reset when the era changes.
- prolepticYear
the proleptic-year
- dayOfYear
the day-of-year
- returns
the Japanese local date, not null
- Definition Classes
- JapaneseChronology → Chronology
- Exceptions thrown
DateTimeException
if unable to create the date
- def dateYearDay(era: Era, yearOfEra: Int, dayOfYear: Int): JapaneseDate
Obtains a local date in Japanese calendar system from the era, year-of-era and day-of-year fields.
Obtains a local date in Japanese calendar system from the era, year-of-era and day-of-year fields.
The day-of-year in this factory is expressed relative to the start of the year-of-era. This definition changes the normal meaning of day-of-year only in those years where the year-of-era is reset to one due to a change in the era. For example:
6th Jan Showa 64 = day-of-year 6 7th Jan Showa 64 = day-of-year 7 8th Jan Heisei 1 = day-of-year 1 9th Jan Heisei 1 = day-of-year 2
- era
the Japanese era, not null
- yearOfEra
the year-of-era
- dayOfYear
the day-of-year
- returns
the Japanese local date, not null
- Definition Classes
- JapaneseChronology → Chronology
- Exceptions thrown
ClassCastException
if the { @code era} is not a { @code JapaneseEra}DateTimeException
if unable to create the date
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(obj: Any): Boolean
Checks if this chronology is equal to another chronology.
Checks if this chronology is equal to another chronology.
The comparison is based on the entire state of the object.
The default implementation checks the type and calls
#compareTo(Chronology)
.- obj
the object to check, null returns false
- returns
true if this is equal to the other chronology
- Definition Classes
- Chronology → AnyRef → Any
- def eraOf(eraValue: Int): JapaneseEra
Returns the calendar system era object from the given numeric value.
Returns the calendar system era object from the given numeric value.
See the description of each Era for the numeric values of:
JapaneseEra#HEISEI
,JapaneseEra#SHOWA
,JapaneseEra#TAISHO
,JapaneseEra#MEIJI
), only Meiji and later eras are supported.- eraValue
the era value
- returns
the Japanese { @code Era} for the given numeric era value
- Definition Classes
- JapaneseChronology → Chronology
- Exceptions thrown
DateTimeException
if { @code eraValue} is invalid
- def eras: List[Era]
Gets the list of eras for the chronology.
Gets the list of eras for the chronology.
Most calendar systems have an era, within which the year has meaning. If the calendar system does not support the concept of eras, an empty list must be returned.
- returns
the list of eras for the chronology, may be immutable, not null
- Definition Classes
- JapaneseChronology → Chronology
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def getCalendarType: String
Gets the calendar type of the underlying calendar system - 'japanese'.
Gets the calendar type of the underlying calendar system - 'japanese'.
The calendar type is an identifier defined by the Unicode Locale Data Markup Language (LDML) specification. It can be used to lookup the
Chronology
using#of(String)
. It can also be used as part of a locale, accessible viaLocale#getUnicodeLocaleType(String)
with the key 'ca'.- returns
the calendar system type - 'japanese'
- Definition Classes
- JapaneseChronology → Chronology
- See also
#getId()
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getDisplayName(style: TextStyle, locale: Locale): String
Gets the textual representation of this chronology.
Gets the textual representation of this chronology.
This returns the textual name used to identify the chronology. The parameters control the style of the returned text and the locale.
- style
the style of the text required, not null
- locale
the locale to use, not null
- returns
the text value of the chronology, not null
- Definition Classes
- Chronology
- def getId: String
Gets the ID of the chronology - 'Japanese'.
Gets the ID of the chronology - 'Japanese'.
The ID uniquely identifies the
Chronology
. It can be used to lookup theChronology
using#of(String)
.- returns
the chronology ID - 'Japanese'
- Definition Classes
- JapaneseChronology → Chronology
- See also
#getCalendarType()
- def hashCode(): Int
A hash code for this chronology.
A hash code for this chronology.
The default implementation is based on the ID and class. Subclasses should add any additional state that they store.
- returns
a suitable hash code
- Definition Classes
- Chronology → AnyRef → Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isLeapYear(prolepticYear: Long): Boolean
Checks if the specified year is a leap year.
Checks if the specified year is a leap year.
Japanese calendar leap years occur exactly in line with ISO leap years. This method does not validate the year passed in, and only has a well-defined result for years in the supported range.
- prolepticYear
the proleptic-year to check, not validated for range
- returns
true if the year is a leap year
- Definition Classes
- JapaneseChronology → Chronology
- def localDateTime(temporal: TemporalAccessor): ChronoLocalDateTime[JapaneseDate]
Obtains a local date-time in this chronology from another temporal object.
Obtains a local date-time in this chronology from another temporal object.
This creates a date-time in this chronology based on the specified
TemporalAccessor
.The date of the date-time should be equivalent to that obtained by calling
#date(TemporalAccessor)
. The standard mechanism for conversion between time types is thenano-of-day
field.- temporal
the temporal object to convert, not null
- returns
the local date-time in this chronology, not null
- Definition Classes
- JapaneseChronology → Chronology
- Exceptions thrown
DateTimeException
if unable to create the date-time
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def period(years: Int, months: Int, days: Int): ChronoPeriod
Obtains a period for this chronology based on years, months and days.
Obtains a period for this chronology based on years, months and days.
This returns a period tied to this chronology using the specified years, months and days. All supplied chronologies use periods based on years, months and days, however the
ChronoPeriod
API allows the period to be represented using other units.The default implementation returns an implementation class suitable for most calendar systems. It is based solely on the three units. Normalization, addition and subtraction derive the number of months in a year from the
#range(ChronoField)
. If the number of months within a year is fixed, then the calculation approach for addition, subtraction and normalization is slightly different.If implementing an unusual calendar system that is not based on years, months and days, or where you want direct control, then the
ChronoPeriod
interface must be directly implemented.The returned period is immutable and thread-safe.
- years
the number of years, may be negative
- months
the number of years, may be negative
- days
the number of years, may be negative
- returns
the period in terms of this chronology, not null
- Definition Classes
- Chronology
- def prolepticYear(era: Era, yearOfEra: Int): Int
Calculates the proleptic-year given the era and year-of-era.
Calculates the proleptic-year given the era and year-of-era.
This combines the era and year-of-era into the single proleptic-year field.
- era
the era of the correct type for the chronology, not null
- yearOfEra
the chronology year-of-era
- returns
the proleptic-year
- Definition Classes
- JapaneseChronology → Chronology
- Exceptions thrown
ClassCastException
if the { @code era} is not of the correct type for the chronologyDateTimeException
if unable to convert
- def range(field: ChronoField): ValueRange
Gets the range of valid values for the specified field.
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.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.
This method will return a result whether or not the chronology supports the field.
- field
the field to get the range for, not null
- returns
the range of valid values for the field, not null
- Definition Classes
- JapaneseChronology → Chronology
- Exceptions thrown
DateTimeException
if the range for the field cannot be obtained
- def resolveDate(fieldValues: Map[TemporalField, Long], resolverStyle: ResolverStyle): JapaneseDate
Resolves parsed
ChronoField
values into a date during parsing.Resolves parsed
ChronoField
values into a date during parsing.Most
TemporalField
implementations are resolved using the resolve method on the field. By contrast, theChronoField
class defines fields that only have meaning relative to the chronology. As such,ChronoField
date fields are resolved here in the context of a specific chronology.The default implementation, which explains typical resolve behaviour, is provided in
AbstractChronology
.- fieldValues
the map of fields to values, which can be updated, not null
- resolverStyle
the requested type of resolve, not null
- returns
the resolved date, null if insufficient information to create a date
- Definition Classes
- JapaneseChronology → Chronology
- Exceptions thrown
DateTimeException
if the date cannot be resolved, typically because of a conflict in the input data
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
Outputs this chronology as a
String
, using the ID.Outputs this chronology as a
String
, using the ID.- returns
a string representation of this chronology, not null
- Definition Classes
- Chronology → AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def zonedDateTime(instant: Instant, zone: ZoneId): ChronoZonedDateTime[JapaneseDate]
Obtains a zoned date-time in this chronology from an
Instant
.Obtains a zoned date-time in this chronology from an
Instant
.This creates a zoned date-time with the same instant as that specified.
- instant
the instant to create the date-time from, not null
- zone
the time-zone, not null
- returns
the zoned date-time, not null
- Definition Classes
- JapaneseChronology → Chronology
- Exceptions thrown
DateTimeException
if the result exceeds the supported range
- def zonedDateTime(temporal: TemporalAccessor): ChronoZonedDateTime[JapaneseDate]
Obtains a zoned date-time in this chronology from another temporal object.
Obtains a zoned date-time in this chronology from another temporal object.
This creates a date-time in this chronology based on the specified
TemporalAccessor
.This should obtain a
ZoneId
usingZoneId#from(TemporalAccessor)
. The date-time should be obtained by obtaining anInstant
. If that fails, the local date-time should be used.- temporal
the temporal object to convert, not null
- returns
the zoned date-time in this chronology, not null
- Definition Classes
- JapaneseChronology → Chronology
- Exceptions thrown
DateTimeException
if unable to create the date-time