< prev index next >

src/java.base/share/classes/java/time/MonthDay.java

Print this page

108  * The ISO-8601 calendar system is the modern civil calendar system used today
109  * in most of the world. It is equivalent to the proleptic Gregorian calendar
110  * system, in which today's rules for leap years are applied for all time.
111  * For most applications written today, the ISO-8601 rules are entirely suitable.
112  * However, any application that makes use of historical dates, and requires them
113  * to be accurate will find the ISO-8601 approach unsuitable.
114  * <p>
115  * This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
116  * class; programmers should treat instances that are
117  * {@linkplain #equals(Object) equal} as interchangeable and should not
118  * use instances for synchronization, or unpredictable behavior may
119  * occur. For example, in a future release, synchronization may fail.
120  * The {@code equals} method should be used for comparisons.
121  *
122  * @implSpec
123  * This class is immutable and thread-safe.
124  *
125  * @since 1.8
126  */
127 @jdk.internal.ValueBased

128 public final class MonthDay
129         implements TemporalAccessor, TemporalAdjuster, Comparable<MonthDay>, Serializable {
130 
131     /**
132      * Serialization version.
133      */
134     @java.io.Serial
135     private static final long serialVersionUID = -939150713474957432L;
136     /**
137      * Parser.
138      */
139     private static final DateTimeFormatter PARSER = new DateTimeFormatterBuilder()
140         .appendLiteral("--")
141         .appendValue(MONTH_OF_YEAR, 2)
142         .appendLiteral('-')
143         .appendValue(DAY_OF_MONTH, 2)
144         .toFormatter();
145 
146     /**
147      * The month-of-year, not null.

108  * The ISO-8601 calendar system is the modern civil calendar system used today
109  * in most of the world. It is equivalent to the proleptic Gregorian calendar
110  * system, in which today's rules for leap years are applied for all time.
111  * For most applications written today, the ISO-8601 rules are entirely suitable.
112  * However, any application that makes use of historical dates, and requires them
113  * to be accurate will find the ISO-8601 approach unsuitable.
114  * <p>
115  * This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
116  * class; programmers should treat instances that are
117  * {@linkplain #equals(Object) equal} as interchangeable and should not
118  * use instances for synchronization, or unpredictable behavior may
119  * occur. For example, in a future release, synchronization may fail.
120  * The {@code equals} method should be used for comparisons.
121  *
122  * @implSpec
123  * This class is immutable and thread-safe.
124  *
125  * @since 1.8
126  */
127 @jdk.internal.ValueBased
128 @jdk.internal.MigratedValueClass
129 public final class MonthDay
130         implements TemporalAccessor, TemporalAdjuster, Comparable<MonthDay>, Serializable {
131 
132     /**
133      * Serialization version.
134      */
135     @java.io.Serial
136     private static final long serialVersionUID = -939150713474957432L;
137     /**
138      * Parser.
139      */
140     private static final DateTimeFormatter PARSER = new DateTimeFormatterBuilder()
141         .appendLiteral("--")
142         .appendValue(MONTH_OF_YEAR, 2)
143         .appendLiteral('-')
144         .appendValue(DAY_OF_MONTH, 2)
145         .toFormatter();
146 
147     /**
148      * The month-of-year, not null.
< prev index next >