127
128 /**
129 * Gets the range of valid values for the specified field.
130 * <p>
131 * All fields can be expressed as a {@code long} integer.
132 * This method returns an object that describes the valid range for that value.
133 * The value of this temporal object is used to enhance the accuracy of the returned range.
134 * If the date-time cannot return the range, because the field is unsupported or for
135 * some other reason, an exception will be thrown.
136 * <p>
137 * Note that the result only describes the minimum and maximum valid values
138 * and it is important not to read too much into them. For example, there
139 * could be values within the range that are invalid for the field.
140 *
141 * @implSpec
142 * Implementations must check and handle all fields defined in {@link ChronoField}.
143 * If the field is supported, then the range of the field must be returned.
144 * If unsupported, then an {@code UnsupportedTemporalTypeException} must be thrown.
145 * <p>
146 * If the field is not a {@code ChronoField}, then the result of this method
147 * is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessorl)}
148 * passing {@code this} as the argument.
149 * <p>
150 * Implementations must ensure that no observable state is altered when this
151 * read-only method is invoked.
152 * <p>
153 * The default implementation must behave equivalent to this code:
154 * <pre>
155 * if (field instanceof ChronoField) {
156 * if (isSupported(field)) {
157 * return field.range();
158 * }
159 * throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
160 * }
161 * return field.rangeRefinedBy(this);
162 * </pre>
163 *
164 * @param field the field to query the range for, not null
165 * @return the range of valid values for the field, not null
166 * @throws DateTimeException if the range for the field cannot be obtained
167 * @throws UnsupportedTemporalTypeException if the field is not supported
|
127
128 /**
129 * Gets the range of valid values for the specified field.
130 * <p>
131 * All fields can be expressed as a {@code long} integer.
132 * This method returns an object that describes the valid range for that value.
133 * The value of this temporal object is used to enhance the accuracy of the returned range.
134 * If the date-time cannot return the range, because the field is unsupported or for
135 * some other reason, an exception will be thrown.
136 * <p>
137 * Note that the result only describes the minimum and maximum valid values
138 * and it is important not to read too much into them. For example, there
139 * could be values within the range that are invalid for the field.
140 *
141 * @implSpec
142 * Implementations must check and handle all fields defined in {@link ChronoField}.
143 * If the field is supported, then the range of the field must be returned.
144 * If unsupported, then an {@code UnsupportedTemporalTypeException} must be thrown.
145 * <p>
146 * If the field is not a {@code ChronoField}, then the result of this method
147 * is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)}
148 * passing {@code this} as the argument.
149 * <p>
150 * Implementations must ensure that no observable state is altered when this
151 * read-only method is invoked.
152 * <p>
153 * The default implementation must behave equivalent to this code:
154 * <pre>
155 * if (field instanceof ChronoField) {
156 * if (isSupported(field)) {
157 * return field.range();
158 * }
159 * throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
160 * }
161 * return field.rangeRefinedBy(this);
162 * </pre>
163 *
164 * @param field the field to query the range for, not null
165 * @return the range of valid values for the field, not null
166 * @throws DateTimeException if the range for the field cannot be obtained
167 * @throws UnsupportedTemporalTypeException if the field is not supported
|