src/java.base/share/classes/java/util/Calendar.java
changeset 58242 94bb65cb37d3
parent 57956 e0b8b019d2f5
child 58288 48e480e56aad
equal deleted inserted replaced
58241:33de7752835c 58242:94bb65cb37d3
  2098      *        (any calendar types specified by {@code locale} are ignored)
  2098      *        (any calendar types specified by {@code locale} are ignored)
  2099      * @return the string representation of the given
  2099      * @return the string representation of the given
  2100      *        {@code field} in the given {@code style}, or
  2100      *        {@code field} in the given {@code style}, or
  2101      *        {@code null} if no string representation is
  2101      *        {@code null} if no string representation is
  2102      *        applicable.
  2102      *        applicable.
  2103      * @exception IllegalArgumentException
  2103      * @throws    IllegalArgumentException
  2104      *        if {@code field} or {@code style} is invalid,
  2104      *        if {@code field} or {@code style} is invalid,
  2105      *        or if this {@code Calendar} is non-lenient and any
  2105      *        or if this {@code Calendar} is non-lenient and any
  2106      *        of the calendar fields have invalid values
  2106      *        of the calendar fields have invalid values
  2107      * @exception NullPointerException
  2107      * @throws    NullPointerException
  2108      *        if {@code locale} is null
  2108      *        if {@code locale} is null
  2109      * @since 1.6
  2109      * @since 1.6
  2110      */
  2110      */
  2111     public String getDisplayName(int field, int style, Locale locale) {
  2111     public String getDisplayName(int field, int style, Locale locale) {
  2112         if (!checkDisplayNameParams(field, style, SHORT, NARROW_FORMAT, locale,
  2112         if (!checkDisplayNameParams(field, style, SHORT, NARROW_FORMAT, locale,
  2189      *        the locale for the display names
  2189      *        the locale for the display names
  2190      * @return a {@code Map} containing all display names in
  2190      * @return a {@code Map} containing all display names in
  2191      *        {@code style} and {@code locale} and their
  2191      *        {@code style} and {@code locale} and their
  2192      *        field values, or {@code null} if no display names
  2192      *        field values, or {@code null} if no display names
  2193      *        are defined for {@code field}
  2193      *        are defined for {@code field}
  2194      * @exception IllegalArgumentException
  2194      * @throws    IllegalArgumentException
  2195      *        if {@code field} or {@code style} is invalid,
  2195      *        if {@code field} or {@code style} is invalid,
  2196      *        or if this {@code Calendar} is non-lenient and any
  2196      *        or if this {@code Calendar} is non-lenient and any
  2197      *        of the calendar fields have invalid values
  2197      *        of the calendar fields have invalid values
  2198      * @exception NullPointerException
  2198      * @throws    NullPointerException
  2199      *        if {@code locale} is null
  2199      *        if {@code locale} is null
  2200      * @since 1.6
  2200      * @since 1.6
  2201      */
  2201      */
  2202     public Map<String, Integer> getDisplayNames(int field, int style, Locale locale) {
  2202     public Map<String, Integer> getDisplayNames(int field, int style, Locale locale) {
  2203         if (!checkDisplayNameParams(field, style, ALL_STYLES, NARROW_FORMAT, locale,
  2203         if (!checkDisplayNameParams(field, style, ALL_STYLES, NARROW_FORMAT, locale,
  2309      * externally by calling one of the setter methods rather than by the
  2309      * externally by calling one of the setter methods rather than by the
  2310      * internal time calculation.
  2310      * internal time calculation.
  2311      *
  2311      *
  2312      * @return <code>true</code> if the field has been set externally,
  2312      * @return <code>true</code> if the field has been set externally,
  2313      * <code>false</code> otherwise.
  2313      * <code>false</code> otherwise.
  2314      * @exception IndexOutOfBoundsException if the specified
  2314      * @throws    IndexOutOfBoundsException if the specified
  2315      *                <code>field</code> is out of range
  2315      *                <code>field</code> is out of range
  2316      *               (<code>field &lt; 0 || field &gt;= FIELD_COUNT</code>).
  2316      *               (<code>field &lt; 0 || field &gt;= FIELD_COUNT</code>).
  2317      * @see #selectFields()
  2317      * @see #selectFields()
  2318      * @see #setFieldsComputed(int)
  2318      * @see #setFieldsComputed(int)
  2319      */
  2319      */
  2342      * <em>computed</em>. This state means that the specified calendar fields
  2342      * <em>computed</em>. This state means that the specified calendar fields
  2343      * have valid values that have been set by internal time calculation
  2343      * have valid values that have been set by internal time calculation
  2344      * rather than by calling one of the setter methods.
  2344      * rather than by calling one of the setter methods.
  2345      *
  2345      *
  2346      * @param fieldMask the field to be marked as computed.
  2346      * @param fieldMask the field to be marked as computed.
  2347      * @exception IndexOutOfBoundsException if the specified
  2347      * @throws    IndexOutOfBoundsException if the specified
  2348      *                <code>field</code> is out of range
  2348      *                <code>field</code> is out of range
  2349      *               (<code>field &lt; 0 || field &gt;= FIELD_COUNT</code>).
  2349      *               (<code>field &lt; 0 || field &gt;= FIELD_COUNT</code>).
  2350      * @see #isExternallySet(int)
  2350      * @see #isExternallySet(int)
  2351      * @see #selectFields()
  2351      * @see #selectFields()
  2352      */
  2352      */
  2379      * <code>Calendar</code> becomes that all the calendar fields are in sync
  2379      * <code>Calendar</code> becomes that all the calendar fields are in sync
  2380      * with the time value (millisecond offset from the Epoch).
  2380      * with the time value (millisecond offset from the Epoch).
  2381      *
  2381      *
  2382      * @param fieldMask the field mask indicating which calendar fields are in
  2382      * @param fieldMask the field mask indicating which calendar fields are in
  2383      * sync with the time value.
  2383      * sync with the time value.
  2384      * @exception IndexOutOfBoundsException if the specified
  2384      * @throws    IndexOutOfBoundsException if the specified
  2385      *                <code>field</code> is out of range
  2385      *                <code>field</code> is out of range
  2386      *               (<code>field &lt; 0 || field &gt;= FIELD_COUNT</code>).
  2386      *               (<code>field &lt; 0 || field &gt;= FIELD_COUNT</code>).
  2387      * @see #isExternallySet(int)
  2387      * @see #isExternallySet(int)
  2388      * @see #selectFields()
  2388      * @see #selectFields()
  2389      */
  2389      */
  2804      * is equal to the time represented by this <code>Calendar</code>; a value
  2804      * is equal to the time represented by this <code>Calendar</code>; a value
  2805      * less than <code>0</code> if the time of this <code>Calendar</code> is
  2805      * less than <code>0</code> if the time of this <code>Calendar</code> is
  2806      * before the time represented by the argument; and a value greater than
  2806      * before the time represented by the argument; and a value greater than
  2807      * <code>0</code> if the time of this <code>Calendar</code> is after the
  2807      * <code>0</code> if the time of this <code>Calendar</code> is after the
  2808      * time represented by the argument.
  2808      * time represented by the argument.
  2809      * @exception NullPointerException if the specified <code>Calendar</code> is
  2809      * @throws    NullPointerException if the specified <code>Calendar</code> is
  2810      *            <code>null</code>.
  2810      *            <code>null</code>.
  2811      * @exception IllegalArgumentException if the time value of the
  2811      * @throws    IllegalArgumentException if the time value of the
  2812      * specified <code>Calendar</code> object can't be obtained due to
  2812      * specified <code>Calendar</code> object can't be obtained due to
  2813      * any invalid calendar values.
  2813      * any invalid calendar values.
  2814      * @since   1.5
  2814      * @since   1.5
  2815      */
  2815      */
  2816     @Override
  2816     @Override
  3052      *
  3052      *
  3053      * <p>The default implementation of this method throws an
  3053      * <p>The default implementation of this method throws an
  3054      * {@link UnsupportedOperationException}.
  3054      * {@link UnsupportedOperationException}.
  3055      *
  3055      *
  3056      * @return the week year of this {@code Calendar}
  3056      * @return the week year of this {@code Calendar}
  3057      * @exception UnsupportedOperationException
  3057      * @throws    UnsupportedOperationException
  3058      *            if any week year numbering isn't supported
  3058      *            if any week year numbering isn't supported
  3059      *            in this {@code Calendar}.
  3059      *            in this {@code Calendar}.
  3060      * @see #isWeekDateSupported()
  3060      * @see #isWeekDateSupported()
  3061      * @see #getFirstDayOfWeek()
  3061      * @see #getFirstDayOfWeek()
  3062      * @see #getMinimalDaysInFirstWeek()
  3062      * @see #getMinimalDaysInFirstWeek()
  3084      * @param weekYear   the week year
  3084      * @param weekYear   the week year
  3085      * @param weekOfYear the week number based on {@code weekYear}
  3085      * @param weekOfYear the week number based on {@code weekYear}
  3086      * @param dayOfWeek  the day of week value: one of the constants
  3086      * @param dayOfWeek  the day of week value: one of the constants
  3087      *                   for the {@link #DAY_OF_WEEK} field: {@link
  3087      *                   for the {@link #DAY_OF_WEEK} field: {@link
  3088      *                   #SUNDAY}, ..., {@link #SATURDAY}.
  3088      *                   #SUNDAY}, ..., {@link #SATURDAY}.
  3089      * @exception IllegalArgumentException
  3089      * @throws    IllegalArgumentException
  3090      *            if any of the given date specifiers is invalid
  3090      *            if any of the given date specifiers is invalid
  3091      *            or any of the calendar fields are inconsistent
  3091      *            or any of the calendar fields are inconsistent
  3092      *            with the given date specifiers in non-lenient mode
  3092      *            with the given date specifiers in non-lenient mode
  3093      * @exception UnsupportedOperationException
  3093      * @throws    UnsupportedOperationException
  3094      *            if any week year numbering isn't supported in this
  3094      *            if any week year numbering isn't supported in this
  3095      *            {@code Calendar}.
  3095      *            {@code Calendar}.
  3096      * @see #isWeekDateSupported()
  3096      * @see #isWeekDateSupported()
  3097      * @see #getFirstDayOfWeek()
  3097      * @see #getFirstDayOfWeek()
  3098      * @see #getMinimalDaysInFirstWeek()
  3098      * @see #getMinimalDaysInFirstWeek()
  3108      *
  3108      *
  3109      * <p>The default implementation of this method throws an
  3109      * <p>The default implementation of this method throws an
  3110      * {@code UnsupportedOperationException}.
  3110      * {@code UnsupportedOperationException}.
  3111      *
  3111      *
  3112      * @return the number of weeks in the week year.
  3112      * @return the number of weeks in the week year.
  3113      * @exception UnsupportedOperationException
  3113      * @throws    UnsupportedOperationException
  3114      *            if any week year numbering isn't supported in this
  3114      *            if any week year numbering isn't supported in this
  3115      *            {@code Calendar}.
  3115      *            {@code Calendar}.
  3116      * @see #WEEK_OF_YEAR
  3116      * @see #WEEK_OF_YEAR
  3117      * @see #isWeekDateSupported()
  3117      * @see #isWeekDateSupported()
  3118      * @see #getWeekYear()
  3118      * @see #getWeekYear()
  3349     /**
  3349     /**
  3350      * Returns the name of the specified calendar field.
  3350      * Returns the name of the specified calendar field.
  3351      *
  3351      *
  3352      * @param field the calendar field
  3352      * @param field the calendar field
  3353      * @return the calendar field name
  3353      * @return the calendar field name
  3354      * @exception IndexOutOfBoundsException if <code>field</code> is negative,
  3354      * @throws    IndexOutOfBoundsException if <code>field</code> is negative,
  3355      * equal to or greater than {@code FIELD_COUNT}.
  3355      * equal to or greater than {@code FIELD_COUNT}.
  3356      */
  3356      */
  3357     static String getFieldName(int field) {
  3357     static String getFieldName(int field) {
  3358         return FIELD_NAME[field];
  3358         return FIELD_NAME[field];
  3359     }
  3359     }