src/java.base/share/classes/java/util/GregorianCalendar.java
changeset 58242 94bb65cb37d3
parent 57956 e0b8b019d2f5
child 58288 48e480e56aad
equal deleted inserted replaced
58241:33de7752835c 58242:94bb65cb37d3
   902      * that are not expected to be invariant. The calendar system
   902      * that are not expected to be invariant. The calendar system
   903      * determines what fields are expected to be invariant.</p>
   903      * determines what fields are expected to be invariant.</p>
   904      *
   904      *
   905      * @param field the calendar field.
   905      * @param field the calendar field.
   906      * @param amount the amount of date or time to be added to the field.
   906      * @param amount the amount of date or time to be added to the field.
   907      * @exception IllegalArgumentException if <code>field</code> is
   907      * @throws    IllegalArgumentException if <code>field</code> is
   908      * <code>ZONE_OFFSET</code>, <code>DST_OFFSET</code>, or unknown,
   908      * <code>ZONE_OFFSET</code>, <code>DST_OFFSET</code>, or unknown,
   909      * or if any calendar fields have out-of-range values in
   909      * or if any calendar fields have out-of-range values in
   910      * non-lenient mode.
   910      * non-lenient mode.
   911      */
   911      */
   912     @Override
   912     @Override
  1099      * sets the calendar to January 31, 1999.  The <code>YEAR</code> field is unchanged
  1099      * sets the calendar to January 31, 1999.  The <code>YEAR</code> field is unchanged
  1100      * because it is a larger field than <code>MONTH</code>.</p>
  1100      * because it is a larger field than <code>MONTH</code>.</p>
  1101      *
  1101      *
  1102      * @param up indicates if the value of the specified calendar field is to be
  1102      * @param up indicates if the value of the specified calendar field is to be
  1103      * rolled up or rolled down. Use <code>true</code> if rolling up, <code>false</code> otherwise.
  1103      * rolled up or rolled down. Use <code>true</code> if rolling up, <code>false</code> otherwise.
  1104      * @exception IllegalArgumentException if <code>field</code> is
  1104      * @throws    IllegalArgumentException if <code>field</code> is
  1105      * <code>ZONE_OFFSET</code>, <code>DST_OFFSET</code>, or unknown,
  1105      * <code>ZONE_OFFSET</code>, <code>DST_OFFSET</code>, or unknown,
  1106      * or if any calendar fields have out-of-range values in
  1106      * or if any calendar fields have out-of-range values in
  1107      * non-lenient mode.
  1107      * non-lenient mode.
  1108      * @see #add(int,int)
  1108      * @see #add(int,int)
  1109      * @see #set(int,int)
  1109      * @see #set(int,int)
  1146      * closest possible value to Sunday (where Sunday is the first day of the
  1146      * closest possible value to Sunday (where Sunday is the first day of the
  1147      * week).</p>
  1147      * week).</p>
  1148      *
  1148      *
  1149      * @param field the calendar field.
  1149      * @param field the calendar field.
  1150      * @param amount the signed amount to add to <code>field</code>.
  1150      * @param amount the signed amount to add to <code>field</code>.
  1151      * @exception IllegalArgumentException if <code>field</code> is
  1151      * @throws    IllegalArgumentException if <code>field</code> is
  1152      * <code>ZONE_OFFSET</code>, <code>DST_OFFSET</code>, or unknown,
  1152      * <code>ZONE_OFFSET</code>, <code>DST_OFFSET</code>, or unknown,
  1153      * or if any calendar fields have out-of-range values in
  1153      * or if any calendar fields have out-of-range values in
  1154      * non-lenient mode.
  1154      * non-lenient mode.
  1155      * @see #roll(int,boolean)
  1155      * @see #roll(int,boolean)
  1156      * @see #add(int,int)
  1156      * @see #add(int,int)
  2181      * @param weekOfYear  the week number based on {@code weekYear}
  2181      * @param weekOfYear  the week number based on {@code weekYear}
  2182      * @param dayOfWeek   the day of week value: one of the constants
  2182      * @param dayOfWeek   the day of week value: one of the constants
  2183      *                    for the {@link #DAY_OF_WEEK DAY_OF_WEEK} field:
  2183      *                    for the {@link #DAY_OF_WEEK DAY_OF_WEEK} field:
  2184      *                    {@link Calendar#SUNDAY SUNDAY}, ...,
  2184      *                    {@link Calendar#SUNDAY SUNDAY}, ...,
  2185      *                    {@link Calendar#SATURDAY SATURDAY}.
  2185      *                    {@link Calendar#SATURDAY SATURDAY}.
  2186      * @exception IllegalArgumentException
  2186      * @throws    IllegalArgumentException
  2187      *            if any of the given date specifiers is invalid,
  2187      *            if any of the given date specifiers is invalid,
  2188      *            or if any of the calendar fields are inconsistent
  2188      *            or if any of the calendar fields are inconsistent
  2189      *            with the given date specifiers in non-lenient mode
  2189      *            with the given date specifiers in non-lenient mode
  2190      * @see GregorianCalendar#isWeekDateSupported()
  2190      * @see GregorianCalendar#isWeekDateSupported()
  2191      * @see Calendar#getFirstDayOfWeek()
  2191      * @see Calendar#getFirstDayOfWeek()
  2624 
  2624 
  2625     /**
  2625     /**
  2626      * Converts calendar field values to the time value (millisecond
  2626      * Converts calendar field values to the time value (millisecond
  2627      * offset from the <a href="Calendar.html#Epoch">Epoch</a>).
  2627      * offset from the <a href="Calendar.html#Epoch">Epoch</a>).
  2628      *
  2628      *
  2629      * @exception IllegalArgumentException if any calendar fields are invalid.
  2629      * @throws    IllegalArgumentException if any calendar fields are invalid.
  2630      */
  2630      */
  2631     @Override
  2631     @Override
  2632     protected void computeTime() {
  2632     protected void computeTime() {
  2633         // In non-lenient mode, perform brief checking of calendar
  2633         // In non-lenient mode, perform brief checking of calendar
  2634         // fields which have been set externally. Through this
  2634         // fields which have been set externally. Through this
  3277      * exception.
  3277      * exception.
  3278      *
  3278      *
  3279      * @param zdt  the zoned date-time object to convert
  3279      * @param zdt  the zoned date-time object to convert
  3280      * @return  the gregorian calendar representing the same point on the
  3280      * @return  the gregorian calendar representing the same point on the
  3281      *  time-line as the zoned date-time provided
  3281      *  time-line as the zoned date-time provided
  3282      * @exception NullPointerException if {@code zdt} is null
  3282      * @throws    NullPointerException if {@code zdt} is null
  3283      * @exception IllegalArgumentException if the zoned date-time is too
  3283      * @throws    IllegalArgumentException if the zoned date-time is too
  3284      * large to represent as a {@code GregorianCalendar}
  3284      * large to represent as a {@code GregorianCalendar}
  3285      * @since 1.8
  3285      * @since 1.8
  3286      */
  3286      */
  3287     public static GregorianCalendar from(ZonedDateTime zdt) {
  3287     public static GregorianCalendar from(ZonedDateTime zdt) {
  3288         GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone(zdt.getZone()));
  3288         GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone(zdt.getZone()));