提交 5875ebe0 编写于 作者: S scolebourne

8025719: Change Chronology to an interface

Summary: Split Chronology and add AbstractChronology
Reviewed-by: darcy
Contributed-by: scolebourne@joda.org
上级 74c0d1a3
......@@ -262,7 +262,7 @@ public interface ChronoLocalDate
* @see #isEqual
*/
static Comparator<ChronoLocalDate> timeLineOrder() {
return Chronology.DATE_ORDER;
return AbstractChronology.DATE_ORDER;
}
//-----------------------------------------------------------------------
......
......@@ -136,7 +136,7 @@ public interface ChronoLocalDateTime<D extends ChronoLocalDate>
* @see #isEqual
*/
static Comparator<ChronoLocalDateTime<?>> timeLineOrder() {
return Chronology.DATE_TIME_ORDER;
return AbstractChronology.DATE_TIME_ORDER;
}
//-----------------------------------------------------------------------
......
......@@ -137,7 +137,7 @@ public interface ChronoZonedDateTime<D extends ChronoLocalDate>
* @see #isEqual
*/
static Comparator<ChronoZonedDateTime<?>> timeLineOrder() {
return Chronology.INSTANT_ORDER;
return AbstractChronology.INSTANT_ORDER;
}
//-----------------------------------------------------------------------
......
......@@ -214,7 +214,7 @@ import sun.util.logging.PlatformLogger;
*
* @since 1.8
*/
public final class HijrahChronology extends Chronology implements Serializable {
public final class HijrahChronology extends AbstractChronology implements Serializable {
/**
* The Hijrah Calendar id.
......@@ -308,8 +308,8 @@ public final class HijrahChronology extends Chronology implements Serializable {
try {
INSTANCE = new HijrahChronology("Hijrah-umalqura");
// Register it by its aliases
Chronology.registerChrono(INSTANCE, "Hijrah");
Chronology.registerChrono(INSTANCE, "islamic");
AbstractChronology.registerChrono(INSTANCE, "Hijrah");
AbstractChronology.registerChrono(INSTANCE, "islamic");
} catch (DateTimeException ex) {
// Absence of Hijrah calendar is fatal to initializing this class.
PlatformLogger logger = PlatformLogger.getLogger("java.time.chrono");
......@@ -336,7 +336,7 @@ public final class HijrahChronology extends Chronology implements Serializable {
try {
// Create and register the variant
HijrahChronology chrono = new HijrahChronology(id);
Chronology.registerChrono(chrono);
AbstractChronology.registerChrono(chrono);
} catch (DateTimeException ex) {
// Log error and continue
PlatformLogger logger = PlatformLogger.getLogger("java.time.chrono");
......
......@@ -120,7 +120,7 @@ import java.util.Objects;
*
* @since 1.8
*/
public final class IsoChronology extends Chronology implements Serializable {
public final class IsoChronology extends AbstractChronology implements Serializable {
/**
* Singleton instance of the ISO chronology.
......
......@@ -120,7 +120,7 @@ import sun.util.calendar.LocalGregorianCalendar;
*
* @since 1.8
*/
public final class JapaneseChronology extends Chronology implements Serializable {
public final class JapaneseChronology extends AbstractChronology implements Serializable {
static final LocalGregorianCalendar JCAL =
(LocalGregorianCalendar) CalendarSystem.forName("japanese");
......
......@@ -105,7 +105,7 @@ import java.util.Map;
*
* @since 1.8
*/
public final class MinguoChronology extends Chronology implements Serializable {
public final class MinguoChronology extends AbstractChronology implements Serializable {
/**
* Singleton instance for the Minguo chronology.
......
......@@ -161,7 +161,7 @@ final class Ser implements Externalizable {
out.writeByte(type);
switch (type) {
case CHRONO_TYPE:
((Chronology) object).writeExternal(out);
((AbstractChronology) object).writeExternal(out);
break;
case CHRONO_LOCAL_DATE_TIME_TYPE:
((ChronoLocalDateTimeImpl<?>) object).writeExternal(out);
......@@ -231,7 +231,7 @@ final class Ser implements Externalizable {
private static Object readInternal(byte type, ObjectInput in) throws IOException, ClassNotFoundException {
switch (type) {
case CHRONO_TYPE: return Chronology.readExternal(in);
case CHRONO_TYPE: return AbstractChronology.readExternal(in);
case CHRONO_LOCAL_DATE_TIME_TYPE: return ChronoLocalDateTimeImpl.readExternal(in);
case CHRONO_ZONE_DATE_TIME_TYPE: return ChronoZonedDateTimeImpl.readExternal(in);
case JAPANESE_DATE_TYPE: return JapaneseDate.readExternal(in);
......
......@@ -106,7 +106,7 @@ import java.util.Map;
*
* @since 1.8
*/
public final class ThaiBuddhistChronology extends Chronology implements Serializable {
public final class ThaiBuddhistChronology extends AbstractChronology implements Serializable {
/**
* Singleton instance of the Buddhist chronology.
......
......@@ -59,13 +59,11 @@ package tck.java.time.chrono;
import static java.time.temporal.ChronoField.EPOCH_DAY;
import java.io.Serializable;
import java.time.chrono.AbstractChronology;
import java.time.chrono.Era;
import java.time.temporal.ChronoField;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.ValueRange;
import java.time.chrono.Chronology;
import java.time.chrono.Era;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
......@@ -95,7 +93,7 @@ import java.util.Locale;
* <h4>Implementation notes</h4>
* This class is immutable and thread-safe.
*/
public final class CopticChronology extends Chronology implements Serializable {
public final class CopticChronology extends AbstractChronology implements Serializable {
/**
* Singleton instance of the Coptic chronology.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册