< prev index next >

src/java.base/share/classes/java/time/chrono/MinguoChronology.java

Print this page




  97  * <li>day-of-year - The Minguo day-of-year exactly matches ISO.
  98  * <li>leap-year - The Minguo leap-year pattern exactly matches ISO, such that the two calendars
  99  *  are never out of step.
 100  * </ul>
 101  *
 102  * @implSpec
 103  * This class is immutable and thread-safe.
 104  *
 105  * @since 1.8
 106  */
 107 public final class MinguoChronology extends AbstractChronology implements Serializable {
 108 
 109     /**
 110      * Singleton instance for the Minguo chronology.
 111      */
 112     public static final MinguoChronology INSTANCE = new MinguoChronology();
 113 
 114     /**
 115      * Serialization version.
 116      */

 117     private static final long serialVersionUID = 1039765215346859963L;
 118     /**
 119      * The difference in years between ISO and Minguo.
 120      */
 121     static final int YEARS_DIFFERENCE = 1911;
 122 
 123     /**
 124      * Restricted constructor.
 125      */
 126     private MinguoChronology() {
 127     }
 128 
 129     //-----------------------------------------------------------------------
 130     /**
 131      * Gets the ID of the chronology - 'Minguo'.
 132      * <p>
 133      * The ID uniquely identifies the {@code Chronology}.
 134      * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
 135      *
 136      * @return the chronology ID - 'Minguo'


 330 
 331     //-----------------------------------------------------------------------
 332     @Override  // override for return type
 333     public MinguoDate resolveDate(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
 334         return (MinguoDate) super.resolveDate(fieldValues, resolverStyle);
 335     }
 336 
 337     //-----------------------------------------------------------------------
 338     /**
 339      * Writes the Chronology using a
 340      * <a href="{@docRoot}/serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
 341      * @serialData
 342      * <pre>
 343      *  out.writeByte(1);     // identifies a Chronology
 344      *  out.writeUTF(getId());
 345      * </pre>
 346      *
 347      * @return the instance of {@code Ser}, not null
 348      */
 349     @Override

 350     Object writeReplace() {
 351         return super.writeReplace();
 352     }
 353 
 354     /**
 355      * Defend against malicious streams.
 356      *
 357      * @param s the stream to read
 358      * @throws InvalidObjectException always
 359      */

 360     private void readObject(ObjectInputStream s) throws InvalidObjectException {
 361         throw new InvalidObjectException("Deserialization via serialization delegate");
 362     }
 363 }


  97  * <li>day-of-year - The Minguo day-of-year exactly matches ISO.
  98  * <li>leap-year - The Minguo leap-year pattern exactly matches ISO, such that the two calendars
  99  *  are never out of step.
 100  * </ul>
 101  *
 102  * @implSpec
 103  * This class is immutable and thread-safe.
 104  *
 105  * @since 1.8
 106  */
 107 public final class MinguoChronology extends AbstractChronology implements Serializable {
 108 
 109     /**
 110      * Singleton instance for the Minguo chronology.
 111      */
 112     public static final MinguoChronology INSTANCE = new MinguoChronology();
 113 
 114     /**
 115      * Serialization version.
 116      */
 117     @java.io.Serial
 118     private static final long serialVersionUID = 1039765215346859963L;
 119     /**
 120      * The difference in years between ISO and Minguo.
 121      */
 122     static final int YEARS_DIFFERENCE = 1911;
 123 
 124     /**
 125      * Restricted constructor.
 126      */
 127     private MinguoChronology() {
 128     }
 129 
 130     //-----------------------------------------------------------------------
 131     /**
 132      * Gets the ID of the chronology - 'Minguo'.
 133      * <p>
 134      * The ID uniquely identifies the {@code Chronology}.
 135      * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
 136      *
 137      * @return the chronology ID - 'Minguo'


 331 
 332     //-----------------------------------------------------------------------
 333     @Override  // override for return type
 334     public MinguoDate resolveDate(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
 335         return (MinguoDate) super.resolveDate(fieldValues, resolverStyle);
 336     }
 337 
 338     //-----------------------------------------------------------------------
 339     /**
 340      * Writes the Chronology using a
 341      * <a href="{@docRoot}/serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
 342      * @serialData
 343      * <pre>
 344      *  out.writeByte(1);     // identifies a Chronology
 345      *  out.writeUTF(getId());
 346      * </pre>
 347      *
 348      * @return the instance of {@code Ser}, not null
 349      */
 350     @Override
 351     @java.io.Serial
 352     Object writeReplace() {
 353         return super.writeReplace();
 354     }
 355 
 356     /**
 357      * Defend against malicious streams.
 358      *
 359      * @param s the stream to read
 360      * @throws InvalidObjectException always
 361      */
 362     @java.io.Serial
 363     private void readObject(ObjectInputStream s) throws InvalidObjectException {
 364         throw new InvalidObjectException("Deserialization via serialization delegate");
 365     }
 366 }
< prev index next >