< prev index next >

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

Print this page

 88 /**
 89  * A date in the Hijrah calendar system.
 90  * <p>
 91  * This date operates using one of several variants of the
 92  * {@linkplain HijrahChronology Hijrah calendar}.
 93  * <p>
 94  * The Hijrah calendar has a different total of days in a year than
 95  * Gregorian calendar, and the length of each month is based on the period
 96  * of a complete revolution of the moon around the earth
 97  * (as between successive new moons).
 98  * Refer to the {@link HijrahChronology} for details of supported variants.
 99  * <p>
100  * Each HijrahDate is created bound to a particular HijrahChronology,
101  * The same chronology is propagated to each HijrahDate computed from the date.
102  * To use a different Hijrah variant, its HijrahChronology can be used
103  * to create new HijrahDate instances.
104  * Alternatively, the {@link #withVariant} method can be used to convert
105  * to a new HijrahChronology.
106  * <p>
107  * This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
108  * class; programmers should treat instances that are
109  * {@linkplain #equals(Object) equal} as interchangeable and should not
110  * use instances for synchronization, or unpredictable behavior may
111  * occur. For example, in a future release, synchronization may fail.
112  * The {@code equals} method should be used for comparisons.







113  *
114  * @implSpec
115  * This class is immutable and thread-safe.
116  *
117  * @since 1.8
118  */
119 @jdk.internal.ValueBased

120 public final class HijrahDate
121         extends ChronoLocalDateImpl<HijrahDate>
122         implements ChronoLocalDate, Serializable {
123 
124     /**
125      * Serialization version.
126      */
127     @java.io.Serial
128     private static final long serialVersionUID = -5207853542612002020L;
129     /**
130      * The Chronology of this HijrahDate.
131      */
132     private final transient HijrahChronology chrono;
133     /**
134      * The proleptic year.
135      */
136     private final transient int prolepticYear;
137     /**
138      * The month-of-year.
139      */

 88 /**
 89  * A date in the Hijrah calendar system.
 90  * <p>
 91  * This date operates using one of several variants of the
 92  * {@linkplain HijrahChronology Hijrah calendar}.
 93  * <p>
 94  * The Hijrah calendar has a different total of days in a year than
 95  * Gregorian calendar, and the length of each month is based on the period
 96  * of a complete revolution of the moon around the earth
 97  * (as between successive new moons).
 98  * Refer to the {@link HijrahChronology} for details of supported variants.
 99  * <p>
100  * Each HijrahDate is created bound to a particular HijrahChronology,
101  * The same chronology is propagated to each HijrahDate computed from the date.
102  * To use a different Hijrah variant, its HijrahChronology can be used
103  * to create new HijrahDate instances.
104  * Alternatively, the {@link #withVariant} method can be used to convert
105  * to a new HijrahChronology.
106  * <p>
107  * This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
108  * class; programmers should treat instances that are {@linkplain #equals(Object) equal}
109  * as interchangeable and should not use instances for synchronization, mutexes, or
110  * with {@linkplain java.lang.ref.Reference object references}.
111  *
112  * <div class="preview-block">
113  *      <div class="preview-comment">
114  *          When preview features are enabled, {@code HijrahDate} is a {@linkplain Class#isValue value class}.
115  *          Use of value class instances for synchronization, mutexes, or with
116  *          {@linkplain java.lang.ref.Reference object references} result in
117  *          {@link IdentityException}.
118  *      </div>
119  * </div>
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 HijrahDate
129         extends ChronoLocalDateImpl<HijrahDate>
130         implements ChronoLocalDate, Serializable {
131 
132     /**
133      * Serialization version.
134      */
135     @java.io.Serial
136     private static final long serialVersionUID = -5207853542612002020L;
137     /**
138      * The Chronology of this HijrahDate.
139      */
140     private final transient HijrahChronology chrono;
141     /**
142      * The proleptic year.
143      */
144     private final transient int prolepticYear;
145     /**
146      * The month-of-year.
147      */
< prev index next >