< prev index next >

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

Print this page

107  * <p>
108  * For example, the Japanese year "Heisei 24" corresponds to ISO year "2012".<br>
109  * Calling {@code japaneseDate.get(YEAR_OF_ERA)} will return 24.<br>
110  * Calling {@code japaneseDate.get(YEAR)} will return 2012.<br>
111  * Calling {@code japaneseDate.get(ERA)} will return 2, corresponding to
112  * {@code JapaneseChronology.ERA_HEISEI}.<br>
113  * <p>
114  * This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
115  * class; programmers should treat instances that are
116  * {@linkplain #equals(Object) equal} as interchangeable and should not
117  * use instances for synchronization, or unpredictable behavior may
118  * occur. For example, in a future release, synchronization may fail.
119  * The {@code equals} method should be used for comparisons.
120  *
121  * @implSpec
122  * This class is immutable and thread-safe.
123  *
124  * @since 1.8
125  */
126 @jdk.internal.ValueBased

127 public final class JapaneseDate
128         extends ChronoLocalDateImpl<JapaneseDate>
129         implements ChronoLocalDate, Serializable {
130 
131     /**
132      * Serialization version.
133      */
134     @java.io.Serial
135     private static final long serialVersionUID = -305327627230580483L;
136 
137     /**
138      * The underlying ISO local date.
139      */
140     private final transient LocalDate isoDate;
141     /**
142      * The JapaneseEra of this date.
143      */
144     private final transient JapaneseEra era;
145     /**
146      * The Japanese imperial calendar year of this date.

107  * <p>
108  * For example, the Japanese year "Heisei 24" corresponds to ISO year "2012".<br>
109  * Calling {@code japaneseDate.get(YEAR_OF_ERA)} will return 24.<br>
110  * Calling {@code japaneseDate.get(YEAR)} will return 2012.<br>
111  * Calling {@code japaneseDate.get(ERA)} will return 2, corresponding to
112  * {@code JapaneseChronology.ERA_HEISEI}.<br>
113  * <p>
114  * This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
115  * class; programmers should treat instances that are
116  * {@linkplain #equals(Object) equal} as interchangeable and should not
117  * use instances for synchronization, or unpredictable behavior may
118  * occur. For example, in a future release, synchronization may fail.
119  * The {@code equals} method should be used for comparisons.
120  *
121  * @implSpec
122  * This class is immutable and thread-safe.
123  *
124  * @since 1.8
125  */
126 @jdk.internal.ValueBased
127 @jdk.internal.MigratedValueClass
128 public final class JapaneseDate
129         extends ChronoLocalDateImpl<JapaneseDate>
130         implements ChronoLocalDate, Serializable {
131 
132     /**
133      * Serialization version.
134      */
135     @java.io.Serial
136     private static final long serialVersionUID = -305327627230580483L;
137 
138     /**
139      * The underlying ISO local date.
140      */
141     private final transient LocalDate isoDate;
142     /**
143      * The JapaneseEra of this date.
144      */
145     private final transient JapaneseEra era;
146     /**
147      * The Japanese imperial calendar year of this date.
< prev index next >