1382 * <p>If no week definition parameters are explicitly given by a call to
1383 * the {@link #setWeekDefinition(int,int) setWeekDefinition} method, the
1384 * {@code Locale}'s default values are used.
1385 *
1386 * @param locale the {@link Locale}
1387 * @throws NullPointerException if {@code locale} is {@code null}
1388 * @return this {@code Calendar.Builder}
1389 * @see Calendar#getInstance(Locale)
1390 */
1391 public Builder setLocale(Locale locale) {
1392 if (locale == null) {
1393 throw new NullPointerException();
1394 }
1395 this.locale = locale;
1396 return this;
1397 }
1398
1399 /**
1400 * Sets the week definition parameters to the values given by
1401 * {@code firstDayOfWeek} and {@code minimalDaysInFirstWeek} that are
1402 * used to determine the <a href="Calendar.html#First_Week">first
1403 * week</a> of a year. The parameters given by this method have
1404 * precedence over the default values given by the
1405 * {@linkplain #setLocale(Locale) locale}.
1406 *
1407 * @param firstDayOfWeek the first day of a week; one of
1408 * {@link Calendar#SUNDAY} to {@link Calendar#SATURDAY}
1409 * @param minimalDaysInFirstWeek the minimal number of days in the first
1410 * week (1..7)
1411 * @return this {@code Calendar.Builder}
1412 * @throws IllegalArgumentException if {@code firstDayOfWeek} or
1413 * {@code minimalDaysInFirstWeek} is invalid
1414 * @see Calendar#getFirstDayOfWeek()
1415 * @see Calendar#getMinimalDaysInFirstWeek()
1416 */
1417 public Builder setWeekDefinition(int firstDayOfWeek, int minimalDaysInFirstWeek) {
1418 if (!isValidWeekParameter(firstDayOfWeek)
1419 || !isValidWeekParameter(minimalDaysInFirstWeek)) {
1420 throw new IllegalArgumentException();
1421 }
1422 this.firstDayOfWeek = firstDayOfWeek;
|
1382 * <p>If no week definition parameters are explicitly given by a call to
1383 * the {@link #setWeekDefinition(int,int) setWeekDefinition} method, the
1384 * {@code Locale}'s default values are used.
1385 *
1386 * @param locale the {@link Locale}
1387 * @throws NullPointerException if {@code locale} is {@code null}
1388 * @return this {@code Calendar.Builder}
1389 * @see Calendar#getInstance(Locale)
1390 */
1391 public Builder setLocale(Locale locale) {
1392 if (locale == null) {
1393 throw new NullPointerException();
1394 }
1395 this.locale = locale;
1396 return this;
1397 }
1398
1399 /**
1400 * Sets the week definition parameters to the values given by
1401 * {@code firstDayOfWeek} and {@code minimalDaysInFirstWeek} that are
1402 * used to determine the <a href="Calendar.html#first_week">first
1403 * week</a> of a year. The parameters given by this method have
1404 * precedence over the default values given by the
1405 * {@linkplain #setLocale(Locale) locale}.
1406 *
1407 * @param firstDayOfWeek the first day of a week; one of
1408 * {@link Calendar#SUNDAY} to {@link Calendar#SATURDAY}
1409 * @param minimalDaysInFirstWeek the minimal number of days in the first
1410 * week (1..7)
1411 * @return this {@code Calendar.Builder}
1412 * @throws IllegalArgumentException if {@code firstDayOfWeek} or
1413 * {@code minimalDaysInFirstWeek} is invalid
1414 * @see Calendar#getFirstDayOfWeek()
1415 * @see Calendar#getMinimalDaysInFirstWeek()
1416 */
1417 public Builder setWeekDefinition(int firstDayOfWeek, int minimalDaysInFirstWeek) {
1418 if (!isValidWeekParameter(firstDayOfWeek)
1419 || !isValidWeekParameter(minimalDaysInFirstWeek)) {
1420 throw new IllegalArgumentException();
1421 }
1422 this.firstDayOfWeek = firstDayOfWeek;
|