99 * <li>day-of-year - The ThaiBuddhist day-of-year exactly matches ISO.
100 * <li>leap-year - The ThaiBuddhist leap-year pattern exactly matches ISO, such that the two calendars
101 * are never out of step.
102 * </ul>
103 *
104 * @implSpec
105 * This class is immutable and thread-safe.
106 *
107 * @since 1.8
108 */
109 public final class ThaiBuddhistChronology extends AbstractChronology implements Serializable {
110
111 /**
112 * Singleton instance of the Buddhist chronology.
113 */
114 public static final ThaiBuddhistChronology INSTANCE = new ThaiBuddhistChronology();
115
116 /**
117 * Serialization version.
118 */
119 private static final long serialVersionUID = 2775954514031616474L;
120 /**
121 * Containing the offset to add to the ISO year.
122 */
123 static final int YEARS_DIFFERENCE = 543;
124 /**
125 * Narrow names for eras.
126 */
127 private static final HashMap<String, String[]> ERA_NARROW_NAMES = new HashMap<>();
128 /**
129 * Short names for eras.
130 */
131 private static final HashMap<String, String[]> ERA_SHORT_NAMES = new HashMap<>();
132 /**
133 * Full names for eras.
134 */
135 private static final HashMap<String, String[]> ERA_FULL_NAMES = new HashMap<>();
136 /**
137 * Fallback language for the era names.
138 */
367
368 //-----------------------------------------------------------------------
369 @Override // override for return type
370 public ThaiBuddhistDate resolveDate(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
371 return (ThaiBuddhistDate) super.resolveDate(fieldValues, resolverStyle);
372 }
373
374 //-----------------------------------------------------------------------
375 /**
376 * Writes the Chronology using a
377 * <a href="{@docRoot}/serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
378 * @serialData
379 * <pre>
380 * out.writeByte(1); // identifies a Chronology
381 * out.writeUTF(getId());
382 * </pre>
383 *
384 * @return the instance of {@code Ser}, not null
385 */
386 @Override
387 Object writeReplace() {
388 return super.writeReplace();
389 }
390
391 /**
392 * Defend against malicious streams.
393 *
394 * @param s the stream to read
395 * @throws InvalidObjectException always
396 */
397 private void readObject(ObjectInputStream s) throws InvalidObjectException {
398 throw new InvalidObjectException("Deserialization via serialization delegate");
399 }
400 }
|
99 * <li>day-of-year - The ThaiBuddhist day-of-year exactly matches ISO.
100 * <li>leap-year - The ThaiBuddhist leap-year pattern exactly matches ISO, such that the two calendars
101 * are never out of step.
102 * </ul>
103 *
104 * @implSpec
105 * This class is immutable and thread-safe.
106 *
107 * @since 1.8
108 */
109 public final class ThaiBuddhistChronology extends AbstractChronology implements Serializable {
110
111 /**
112 * Singleton instance of the Buddhist chronology.
113 */
114 public static final ThaiBuddhistChronology INSTANCE = new ThaiBuddhistChronology();
115
116 /**
117 * Serialization version.
118 */
119 @java.io.Serial
120 private static final long serialVersionUID = 2775954514031616474L;
121 /**
122 * Containing the offset to add to the ISO year.
123 */
124 static final int YEARS_DIFFERENCE = 543;
125 /**
126 * Narrow names for eras.
127 */
128 private static final HashMap<String, String[]> ERA_NARROW_NAMES = new HashMap<>();
129 /**
130 * Short names for eras.
131 */
132 private static final HashMap<String, String[]> ERA_SHORT_NAMES = new HashMap<>();
133 /**
134 * Full names for eras.
135 */
136 private static final HashMap<String, String[]> ERA_FULL_NAMES = new HashMap<>();
137 /**
138 * Fallback language for the era names.
139 */
368
369 //-----------------------------------------------------------------------
370 @Override // override for return type
371 public ThaiBuddhistDate resolveDate(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
372 return (ThaiBuddhistDate) super.resolveDate(fieldValues, resolverStyle);
373 }
374
375 //-----------------------------------------------------------------------
376 /**
377 * Writes the Chronology using a
378 * <a href="{@docRoot}/serialized-form.html#java.time.chrono.Ser">dedicated serialized form</a>.
379 * @serialData
380 * <pre>
381 * out.writeByte(1); // identifies a Chronology
382 * out.writeUTF(getId());
383 * </pre>
384 *
385 * @return the instance of {@code Ser}, not null
386 */
387 @Override
388 @java.io.Serial
389 Object writeReplace() {
390 return super.writeReplace();
391 }
392
393 /**
394 * Defend against malicious streams.
395 *
396 * @param s the stream to read
397 * @throws InvalidObjectException always
398 */
399 @java.io.Serial
400 private void readObject(ObjectInputStream s) throws InvalidObjectException {
401 throw new InvalidObjectException("Deserialization via serialization delegate");
402 }
403 }
|