@Override public ValueRange rangeRefinedBy(TemporalAccessor temporal){ return temporal.range(this); }
@Override public ValueRange rangeRefinedBy(TemporalAccessor temporal) { return temporal.range(this); }
/** * Gets the range of valid values for the specified field. * <p> * The range object expresses the minimum and maximum valid values for a field. * This day-of-month is used to enhance the accuracy of the returned range. * If it is not possible to return the range, because the field is not supported * or for some other reason, an exception is thrown. * <p> * If the field is a {@link ChronoField} then the query is implemented here. * The {@link #isSupported(TemporalField) supported fields} will return * appropriate range instances. * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. * <p> * If the field is not a {@code ChronoField}, then the result of this method * is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} * passing {@code this} as the argument. * Whether the range can be obtained is determined by the field. * * @param field the field to query the range for, not null * @return the range of valid values for the field, not null * @throws DateTimeException if the range for the field cannot be obtained * @throws UnsupportedTemporalTypeException if the field is not supported */ @Override public ValueRange range(TemporalField field) { return TemporalAccessor.super.range(field); }
/** * Gets the range of valid values for the specified field. * <p> * The range object expresses the minimum and maximum valid values for a field. * This day-of-year is used to enhance the accuracy of the returned range. * If it is not possible to return the range, because the field is not supported * or for some other reason, an exception is thrown. * <p> * If the field is a {@link ChronoField} then the query is implemented here. * The {@link #isSupported(TemporalField) supported fields} will return * appropriate range instances. * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. * <p> * If the field is not a {@code ChronoField}, then the result of this method * is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)} * passing {@code this} as the argument. * Whether the range can be obtained is determined by the field. * * @param field the field to query the range for, not null * @return the range of valid values for the field, not null * @throws DateTimeException if the range for the field cannot be obtained * @throws UnsupportedTemporalTypeException if the field is not supported */ @Override public ValueRange range(TemporalField field) { return TemporalAccessor.super.range(field); }
@Override default ValueRange range(TemporalField field) { return this.toTemporalAccessor().range(field); }
@Override public ValueRange range(TemporalField field) { if (effectiveDate != null && field.isDateBased()) { return effectiveDate.range(field); } return temporal.range(field); } @Override
throw new UnsupportedTemporalTypeException("Unsupported field: " + field); return TemporalAccessor.super.range(field);
/** * Gets the range of valid values for the specified field. * <p> * The range object expresses the minimum and maximum valid values for a field. * This year-week is used to enhance the accuracy of the returned range. * If it is not possible to return the range, because the field is not supported * or for some other reason, an exception is thrown. * <p> * The range for the {@link IsoFields#WEEK_BASED_YEAR WEEK_BASED_YEAR} and * {@link IsoFields#WEEK_OF_WEEK_BASED_YEAR WEEK_OF_WEEK_BASED_YEAR} fields is returned. * All {@link ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. * * @param field the field to query the range for, not null * @return the range of valid values for the field, not null * @throws DateTimeException if the range for the field cannot be obtained * @throws UnsupportedTemporalTypeException if the field is not supported */ @Override public ValueRange range(TemporalField field) { if (field == WEEK_BASED_YEAR) { return WEEK_BASED_YEAR.range(); } if (field == WEEK_OF_WEEK_BASED_YEAR) { return ValueRange.of(1, weekRange(year)); } return TemporalAccessor.super.range(field); }
@Override public ValueRange rangeRefinedBy(TemporalAccessor temporal) { if (rangeUnit == ChronoUnit.WEEKS) { return range; } TemporalField field = null; if (rangeUnit == ChronoUnit.MONTHS) { field = ChronoField.DAY_OF_MONTH; } else if (rangeUnit == ChronoUnit.YEARS) { field = ChronoField.DAY_OF_YEAR; } else if (rangeUnit == IsoFields.WEEK_BASED_YEARS) { return rangeWOWBY(temporal); } else if (rangeUnit == ChronoUnit.FOREVER) { return temporal.range(YEAR); } else { throw new IllegalStateException("unreachable"); } // Offset the ISO DOW by the start of this week int sow = weekDef.getFirstDayOfWeek().getValue(); int isoDow = temporal.get(ChronoField.DAY_OF_WEEK); int dow = Jdk8Methods.floorMod(isoDow - sow, 7) + 1; int offset = startOfWeekOffset(temporal.get(field), dow); ValueRange fieldRange = temporal.range(field); return ValueRange.of(computeWeek(offset, (int) fieldRange.getMinimum()), computeWeek(offset, (int) fieldRange.getMaximum())); }