TemporalAccessor.range

Gets the range of valid values for the specified field. !(p) All fields can be expressed as a {@code long} integer. This method returns an object that describes the valid range for that value. The value of this temporal object is used to enhance the accuracy of the returned range. If the date-time cannot return the range, because the field is unsupported or for some other reason, an exception will be thrown. !(p) Note that the result only describes the minimum and maximum valid values and it is important not to read too much into them. For example, there could be values within the range that are invalid for the field.

@implSpec Implementations must check and handle all fields defined _in {@link ChronoField}. If the field is supported, then the range of the field must be returned. If unsupported, then an {@code UnsupportedTemporalTypeException} must be thrown. !(p) If the field is not a {@code ChronoField}, then the result of this method is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessorl)} passing {@code this} as the argument. !(p) Implementations must ensure that no observable state is altered when this read-only method is invoked. !(p) The implementation must behave equivalent to this code: !(pre) if (cast(ChronoField)(field) !is null) { if (isSupported(field)) { return field.range(); } throw new UnsupportedTemporalTypeException("Unsupported field: " ~ field); } return field.rangeRefinedBy(this); </pre>

@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

interface TemporalAccessor
range

Meta