jdk/src/share/classes/java/time/chrono/JapaneseDate.java
changeset 19841 15c8e97d6a14
parent 19030 32f129cb6351
child 20518 dde564773845
equal deleted inserted replaced
19822:4e10a58fa28f 19841:15c8e97d6a14
    67 import static java.time.temporal.ChronoField.YEAR_OF_ERA;
    67 import static java.time.temporal.ChronoField.YEAR_OF_ERA;
    68 
    68 
    69 import java.io.DataInput;
    69 import java.io.DataInput;
    70 import java.io.DataOutput;
    70 import java.io.DataOutput;
    71 import java.io.IOException;
    71 import java.io.IOException;
       
    72 import java.io.InvalidObjectException;
    72 import java.io.Serializable;
    73 import java.io.Serializable;
    73 import java.time.Clock;
    74 import java.time.Clock;
    74 import java.time.DateTimeException;
    75 import java.time.DateTimeException;
    75 import java.time.LocalDate;
    76 import java.time.LocalDate;
    76 import java.time.LocalTime;
    77 import java.time.LocalTime;
   127     private static final long serialVersionUID = -305327627230580483L;
   128     private static final long serialVersionUID = -305327627230580483L;
   128 
   129 
   129     /**
   130     /**
   130      * The underlying ISO local date.
   131      * The underlying ISO local date.
   131      */
   132      */
   132     private transient final LocalDate isoDate;
   133     private final transient LocalDate isoDate;
   133     /**
   134     /**
   134      * The JapaneseEra of this date.
   135      * The JapaneseEra of this date.
   135      */
   136      */
   136     private transient JapaneseEra era;
   137     private transient JapaneseEra era;
   137     /**
   138     /**
   687     public int hashCode() {
   688     public int hashCode() {
   688         return getChronology().getId().hashCode() ^ isoDate.hashCode();
   689         return getChronology().getId().hashCode() ^ isoDate.hashCode();
   689     }
   690     }
   690 
   691 
   691     //-----------------------------------------------------------------------
   692     //-----------------------------------------------------------------------
       
   693     /**
       
   694      * Defend against malicious streams.
       
   695      * @return never
       
   696      * @throws InvalidObjectException always
       
   697      */
       
   698     private Object readResolve() throws InvalidObjectException {
       
   699         throw new InvalidObjectException("Deserialization via serialization delegate");
       
   700     }
       
   701 
       
   702     /**
       
   703      * Writes the object using a
       
   704      * <a href="../../../serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
       
   705      * @serialData
       
   706      * <pre>
       
   707      *  out.writeByte(4);                 // identifies a JapaneseDate
       
   708      *  out.writeInt(get(YEAR));
       
   709      *  out.writeByte(get(MONTH_OF_YEAR));
       
   710      *  out.writeByte(get(DAY_OF_MONTH));
       
   711      * </pre>
       
   712      *
       
   713      * @return the instance of {@code Ser}, not null
       
   714      */
   692     private Object writeReplace() {
   715     private Object writeReplace() {
   693         return new Ser(Ser.JAPANESE_DATE_TYPE, this);
   716         return new Ser(Ser.JAPANESE_DATE_TYPE, this);
   694     }
   717     }
   695 
   718 
   696     void writeExternal(DataOutput out) throws IOException {
   719     void writeExternal(DataOutput out) throws IOException {