45 * 46 * * Neither the name of JSR-310 nor the names of its contributors 47 * may be used to endorse or promote products derived from this software 48 * without specific prior written permission. 49 * 50 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 51 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 52 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 53 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 54 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 55 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 56 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 57 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 58 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 59 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 60 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 61 */ 62 package java.time.temporal; 63 64 import java.time.DateTimeException; 65 import java.util.Comparator; 66 import java.util.Map; 67 68 /** 69 * A field of date-time, such as month-of-year or hour-of-minute. 70 * <p> 71 * Date and time is expressed using fields which partition the time-line into something 72 * meaningful for humans. Implementations of this interface represent those fields. 73 * <p> 74 * The most commonly used units are defined in {@link ChronoField}. 75 * Further fields are supplied in {@link IsoFields}, {@link WeekFields} and {@link JulianFields}. 76 * Fields can also be written by application code by implementing this interface. 77 * <p> 78 * The field works using double dispatch. Client code calls methods on a date-time like 79 * {@code LocalDateTime} which check if the field is a {@code ChronoField}. 80 * If it is, then the date-time must handle it. 81 * Otherwise, the method call is re-dispatched to the matching method in this interface. 82 * 83 * <h3>Specification for implementors</h3> 84 * This interface must be implemented with care to ensure other classes operate correctly. 85 * All implementations that can be instantiated must be final, immutable and thread-safe. 86 * Implementations should be {@code Serializable} where possible. 87 * An enum is as effective implementation choice. 88 * 89 * @since 1.8 90 */ 91 public interface TemporalField extends Comparator<TemporalAccessor> { 92 93 /** 94 * Gets a descriptive name for the field. 95 * <p> 96 * The should be of the format 'BaseOfRange', such as 'MonthOfYear', 97 * unless the field has a range of {@code FOREVER}, when only 98 * the base unit is mentioned, such as 'Year' or 'Era'. 99 * 100 * @return the name, not null 101 */ 102 String getName(); 103 104 /** 105 * Gets the unit that the field is measured in. 106 * <p> 107 * The unit of the field is the period that varies within the range. 108 * For example, in the field 'MonthOfYear', the unit is 'Months'. 109 * See also {@link #getRangeUnit()}. 110 * 111 * @return the period unit defining the base unit of the field, not null 112 */ 113 TemporalUnit getBaseUnit(); 114 115 /** 116 * Gets the range that the field is bound by. 117 * <p> 118 * The range of the field is the period that the field varies within. 119 * For example, in the field 'MonthOfYear', the range is 'Years'. 120 * See also {@link #getBaseUnit()}. 121 * <p> 122 * The range is never null. For example, the 'Year' field is shorthand for 123 * 'YearOfForever'. It therefore has a unit of 'Years' and a range of 'Forever'. 124 * 125 * @return the period unit defining the range of the field, not null 126 */ 127 TemporalUnit getRangeUnit(); 128 129 //----------------------------------------------------------------------- 130 /** 131 * Compares the value of this field in two temporal objects. 132 * <p> 133 * All fields implement {@link Comparator} on {@link TemporalAccessor}. 134 * This allows a list of date-times to be compared using the value of a field. 135 * For example, you could sort a list of arbitrary temporal objects by the value of 136 * the month-of-year field - {@code Collections.sort(list, MONTH_OF_YEAR)} 137 * <p> 138 * The default implementation must behave equivalent to this code: 139 * <pre> 140 * return Long.compare(temporal1.getLong(this), temporal2.getLong(this)); 141 * </pre> 142 * 143 * @param temporal1 the first temporal object to compare, not null 144 * @param temporal2 the second temporal object to compare, not null 145 * @throws DateTimeException if unable to obtain the value for this field 146 */ 147 public default int compare(TemporalAccessor temporal1, TemporalAccessor temporal2) { 148 return Long.compare(temporal1.getLong(this), temporal2.getLong(this)); 149 } 150 151 /** 152 * Gets the range of valid values for the field. 153 * <p> 154 * All fields can be expressed as a {@code long} integer. 155 * This method returns an object that describes the valid range for that value. 156 * This method is generally only applicable to the ISO-8601 calendar system. 157 * <p> 158 * Note that the result only describes the minimum and maximum valid values 159 * and it is important not to read too much into them. For example, there 160 * could be values within the range that are invalid for the field. 161 * 162 * @return the range of valid values for the field, not null 163 */ 164 ValueRange range(); 165 166 //----------------------------------------------------------------------- 167 /** 168 * Checks if this field is supported by the temporal object. 169 * <p> 170 * This determines whether the temporal accessor supports this field. 171 * If this returns false, the the temporal cannot be queried for this field. 172 * <p> 173 * There are two equivalent ways of using this method. 174 * The first is to invoke this method directly. 175 * The second is to use {@link TemporalAccessor#isSupported(TemporalField)}: 176 * <pre> 177 * // these two lines are equivalent, but the second approach is recommended 178 * temporal = thisField.isSupportedBy(temporal); 179 * temporal = temporal.isSupported(thisField); 180 * </pre> 181 * It is recommended to use the second approach, {@code isSupported(TemporalField)}, 182 * as it is a lot clearer to read in code. 183 * <p> 184 * Implementations should determine whether they are supported using the fields 185 * available in {@link ChronoField}. 186 * 187 * @param temporal the temporal object to query, not null 196 * This uses the temporal object to find the range of valid values for the field. 197 * This is similar to {@link #range()}, however this method refines the result 198 * using the temporal. For example, if the field is {@code DAY_OF_MONTH} the 199 * {@code range} method is not accurate as there are four possible month lengths, 200 * 28, 29, 30 and 31 days. Using this method with a date allows the range to be 201 * accurate, returning just one of those four options. 202 * <p> 203 * There are two equivalent ways of using this method. 204 * The first is to invoke this method directly. 205 * The second is to use {@link TemporalAccessor#range(TemporalField)}: 206 * <pre> 207 * // these two lines are equivalent, but the second approach is recommended 208 * temporal = thisField.rangeRefinedBy(temporal); 209 * temporal = temporal.range(thisField); 210 * </pre> 211 * It is recommended to use the second approach, {@code range(TemporalField)}, 212 * as it is a lot clearer to read in code. 213 * <p> 214 * Implementations should perform any queries or calculations using the fields 215 * available in {@link ChronoField}. 216 * If the field is not supported a {@code DateTimeException} must be thrown. 217 * 218 * @param temporal the temporal object used to refine the result, not null 219 * @return the range of valid values for this field, not null 220 * @throws DateTimeException if the range for the field cannot be obtained 221 */ 222 ValueRange rangeRefinedBy(TemporalAccessor temporal); 223 224 /** 225 * Gets the value of this field from the specified temporal object. 226 * <p> 227 * This queries the temporal object for the value of this field. 228 * <p> 229 * There are two equivalent ways of using this method. 230 * The first is to invoke this method directly. 231 * The second is to use {@link TemporalAccessor#getLong(TemporalField)} 232 * (or {@link TemporalAccessor#get(TemporalField)}): 233 * <pre> 234 * // these two lines are equivalent, but the second approach is recommended 235 * temporal = thisField.getFrom(temporal); 236 * temporal = temporal.getLong(thisField); 237 * </pre> 238 * It is recommended to use the second approach, {@code getLong(TemporalField)}, 239 * as it is a lot clearer to read in code. 240 * <p> 241 * Implementations should perform any queries or calculations using the fields 242 * available in {@link ChronoField}. 243 * If the field is not supported a {@code DateTimeException} must be thrown. 244 * 245 * @param temporal the temporal object to query, not null 246 * @return the value of this field, not null 247 * @throws DateTimeException if a value for the field cannot be obtained 248 * @throws ArithmeticException if numeric overflow occurs 249 */ 250 long getFrom(TemporalAccessor temporal); 251 252 /** 253 * Returns a copy of the specified temporal object with the value of this field set. 254 * <p> 255 * This returns a new temporal object based on the specified one with the value for 256 * this field changed. For example, on a {@code LocalDate}, this could be used to 257 * set the year, month or day-of-month. 258 * The returned object has the same observable type as the specified object. 259 * <p> 260 * In some cases, changing a field is not fully defined. For example, if the target object is 261 * a date representing the 31st January, then changing the month to February would be unclear. 262 * In cases like this, the implementation is responsible for resolving the result. 263 * Typically it will choose the previous valid date, which would be the last valid 264 * day of February in this example. 265 * <p> 266 * There are two equivalent ways of using this method. 267 * The first is to invoke this method directly. 268 * The second is to use {@link Temporal#with(TemporalField, long)}: 269 * <pre> 270 * // these two lines are equivalent, but the second approach is recommended 271 * temporal = thisField.adjustInto(temporal); 272 * temporal = temporal.with(thisField); 273 * </pre> 274 * It is recommended to use the second approach, {@code with(TemporalField)}, 275 * as it is a lot clearer to read in code. 276 * <p> 277 * Implementations should perform any queries or calculations using the fields 278 * available in {@link ChronoField}. 279 * If the field is not supported a {@code DateTimeException} must be thrown. 280 * <p> 281 * Implementations must not alter the specified temporal object. 282 * Instead, an adjusted copy of the original must be returned. 283 * This provides equivalent, safe behavior for immutable and mutable implementations. 284 * 285 * @param <R> the type of the Temporal object 286 * @param temporal the temporal object to adjust, not null 287 * @param newValue the new value of the field 288 * @return the adjusted temporal object, not null 289 * @throws DateTimeException if the field cannot be set 290 * @throws ArithmeticException if numeric overflow occurs 291 */ 292 <R extends Temporal> R adjustInto(R temporal, long newValue); 293 294 /** 295 * Resolves this field to provide a simpler alternative. 296 * <p> 297 * This method is invoked during the resolve phase of parsing. 298 * It is designed to allow application defined fields to be simplified into 299 * more standard fields, such as those on {@code ChronoField}. 300 * <p> 301 * The method will only be invoked if the specified temporal supports this field. 302 * The value of this field is provided. 303 * <p> 304 * The temporal must be queried using the methods of {@code TemporalAccessor}, 305 * not using {@code getFrom}, {@code isSupportedBy} or {@code rangeRefinedBy}. 306 * Before querying any field, implementations must ensure it is supported, as 307 * exceptions of this type would negatively affect the calculation of a parsed result. 308 * <p> 309 * If this field can resolve, it must return a map, if not it must return null. 310 * The returned map contains the changes to be made to the temporal, expressed 311 * as field-value pairs. If the value for a field is null, the field is to be 312 * removed from the temporal. A null key must not be added to the result map. 313 * <p> 314 * If the result is non-null, this field will be removed from the temporal. 315 * This field should not be added to the result map. 316 * <p> 317 * The default implementation must return null. 318 * 319 * @param temporal the temporal to resolve, not null 320 * @param value the value of this field 321 * @return a map of fields to update in the temporal, with a mapping to null 322 * indicating a deletion. The whole map must be null if no resolving occurred 323 * @throws DateTimeException if resolving results in an error. This must not be thrown 324 * by querying a field on the temporal without first checking if it is supported 325 * @throws ArithmeticException if numeric overflow occurs 326 */ 327 public default Map<TemporalField, Long> resolve(TemporalAccessor temporal, long value) { 328 return null; 329 } 330 331 } | 45 * 46 * * Neither the name of JSR-310 nor the names of its contributors 47 * may be used to endorse or promote products derived from this software 48 * without specific prior written permission. 49 * 50 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 51 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 52 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 53 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 54 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 55 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 56 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 57 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 58 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 59 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 60 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 61 */ 62 package java.time.temporal; 63 64 import java.time.DateTimeException; 65 import java.time.format.ResolverStyle; 66 import java.util.Locale; 67 import java.util.Map; 68 import java.util.Objects; 69 70 /** 71 * A field of date-time, such as month-of-year or hour-of-minute. 72 * <p> 73 * Date and time is expressed using fields which partition the time-line into something 74 * meaningful for humans. Implementations of this interface represent those fields. 75 * <p> 76 * The most commonly used units are defined in {@link ChronoField}. 77 * Further fields are supplied in {@link IsoFields}, {@link WeekFields} and {@link JulianFields}. 78 * Fields can also be written by application code by implementing this interface. 79 * <p> 80 * The field works using double dispatch. Client code calls methods on a date-time like 81 * {@code LocalDateTime} which check if the field is a {@code ChronoField}. 82 * If it is, then the date-time must handle it. 83 * Otherwise, the method call is re-dispatched to the matching method in this interface. 84 * 85 * <h3>Specification for implementors</h3> 86 * This interface must be implemented with care to ensure other classes operate correctly. 87 * All implementations that can be instantiated must be final, immutable and thread-safe. 88 * Implementations should be {@code Serializable} where possible. 89 * An enum is as effective implementation choice. 90 * 91 * @since 1.8 92 */ 93 public interface TemporalField { 94 95 /** 96 * Gets a descriptive name for the field. 97 * <p> 98 * The should be of the format 'BaseOfRange', such as 'MonthOfYear', 99 * unless the field has a range of {@code FOREVER}, when only 100 * the base unit is mentioned, such as 'Year' or 'Era'. 101 * 102 * @return the name, not null 103 */ 104 String getName(); 105 106 /** 107 * Gets the display name for the field in the requested locale. 108 * <p> 109 * If there is no display name for the locale the value of {@code getName} 110 * is returned. 111 * 112 * @param locale the locale to use, not null 113 * @return the display name for the locale or the value of {@code getName}, 114 * not null 115 */ 116 default String getDisplayName(Locale locale) { 117 Objects.requireNonNull(locale, "local"); 118 return getName(); 119 } 120 121 /** 122 * Gets the unit that the field is measured in. 123 * <p> 124 * The unit of the field is the period that varies within the range. 125 * For example, in the field 'MonthOfYear', the unit is 'Months'. 126 * See also {@link #getRangeUnit()}. 127 * 128 * @return the period unit defining the base unit of the field, not null 129 */ 130 TemporalUnit getBaseUnit(); 131 132 /** 133 * Gets the range that the field is bound by. 134 * <p> 135 * The range of the field is the period that the field varies within. 136 * For example, in the field 'MonthOfYear', the range is 'Years'. 137 * See also {@link #getBaseUnit()}. 138 * <p> 139 * The range is never null. For example, the 'Year' field is shorthand for 140 * 'YearOfForever'. It therefore has a unit of 'Years' and a range of 'Forever'. 141 * 142 * @return the period unit defining the range of the field, not null 143 */ 144 TemporalUnit getRangeUnit(); 145 146 /** 147 * Gets the range of valid values for the field. 148 * <p> 149 * All fields can be expressed as a {@code long} integer. 150 * This method returns an object that describes the valid range for that value. 151 * This method is generally only applicable to the ISO-8601 calendar system. 152 * <p> 153 * Note that the result only describes the minimum and maximum valid values 154 * and it is important not to read too much into them. For example, there 155 * could be values within the range that are invalid for the field. 156 * 157 * @return the range of valid values for the field, not null 158 */ 159 ValueRange range(); 160 161 //----------------------------------------------------------------------- 162 /** 163 * Checks if this field represents a component of a date. 164 * <p> 165 * A field is date-based if it can be derived from 166 * {@link ChronoField#EPOCH_DAY EPOCH_DAY}. 167 * <p> 168 * The default implementation must return false. 169 * 170 * @return true if this field is a component of a date 171 */ 172 default boolean isDateBased() { 173 return false; 174 } 175 176 /** 177 * Checks if this field represents a component of a time. 178 * <p> 179 * A field is time-based if it can be derived from 180 * {@link ChronoField#NANO_OF_DAY NANO_OF_DAY}. 181 * <p> 182 * The default implementation must return false. 183 * 184 * @return true if this field is a component of a time 185 */ 186 default boolean isTimeBased() { 187 return false; 188 } 189 190 //----------------------------------------------------------------------- 191 /** 192 * Checks if this field is supported by the temporal object. 193 * <p> 194 * This determines whether the temporal accessor supports this field. 195 * If this returns false, the the temporal cannot be queried for this field. 196 * <p> 197 * There are two equivalent ways of using this method. 198 * The first is to invoke this method directly. 199 * The second is to use {@link TemporalAccessor#isSupported(TemporalField)}: 200 * <pre> 201 * // these two lines are equivalent, but the second approach is recommended 202 * temporal = thisField.isSupportedBy(temporal); 203 * temporal = temporal.isSupported(thisField); 204 * </pre> 205 * It is recommended to use the second approach, {@code isSupported(TemporalField)}, 206 * as it is a lot clearer to read in code. 207 * <p> 208 * Implementations should determine whether they are supported using the fields 209 * available in {@link ChronoField}. 210 * 211 * @param temporal the temporal object to query, not null 220 * This uses the temporal object to find the range of valid values for the field. 221 * This is similar to {@link #range()}, however this method refines the result 222 * using the temporal. For example, if the field is {@code DAY_OF_MONTH} the 223 * {@code range} method is not accurate as there are four possible month lengths, 224 * 28, 29, 30 and 31 days. Using this method with a date allows the range to be 225 * accurate, returning just one of those four options. 226 * <p> 227 * There are two equivalent ways of using this method. 228 * The first is to invoke this method directly. 229 * The second is to use {@link TemporalAccessor#range(TemporalField)}: 230 * <pre> 231 * // these two lines are equivalent, but the second approach is recommended 232 * temporal = thisField.rangeRefinedBy(temporal); 233 * temporal = temporal.range(thisField); 234 * </pre> 235 * It is recommended to use the second approach, {@code range(TemporalField)}, 236 * as it is a lot clearer to read in code. 237 * <p> 238 * Implementations should perform any queries or calculations using the fields 239 * available in {@link ChronoField}. 240 * If the field is not supported an {@code UnsupportedTemporalTypeException} must be thrown. 241 * 242 * @param temporal the temporal object used to refine the result, not null 243 * @return the range of valid values for this field, not null 244 * @throws DateTimeException if the range for the field cannot be obtained 245 * @throws UnsupportedTemporalTypeException if the field is not supported by the temporal 246 */ 247 ValueRange rangeRefinedBy(TemporalAccessor temporal); 248 249 /** 250 * Gets the value of this field from the specified temporal object. 251 * <p> 252 * This queries the temporal object for the value of this field. 253 * <p> 254 * There are two equivalent ways of using this method. 255 * The first is to invoke this method directly. 256 * The second is to use {@link TemporalAccessor#getLong(TemporalField)} 257 * (or {@link TemporalAccessor#get(TemporalField)}): 258 * <pre> 259 * // these two lines are equivalent, but the second approach is recommended 260 * temporal = thisField.getFrom(temporal); 261 * temporal = temporal.getLong(thisField); 262 * </pre> 263 * It is recommended to use the second approach, {@code getLong(TemporalField)}, 264 * as it is a lot clearer to read in code. 265 * <p> 266 * Implementations should perform any queries or calculations using the fields 267 * available in {@link ChronoField}. 268 * If the field is not supported an {@code UnsupportedTemporalTypeException} must be thrown. 269 * 270 * @param temporal the temporal object to query, not null 271 * @return the value of this field, not null 272 * @throws DateTimeException if a value for the field cannot be obtained 273 * @throws UnsupportedTemporalTypeException if the field is not supported by the temporal 274 * @throws ArithmeticException if numeric overflow occurs 275 */ 276 long getFrom(TemporalAccessor temporal); 277 278 /** 279 * Returns a copy of the specified temporal object with the value of this field set. 280 * <p> 281 * This returns a new temporal object based on the specified one with the value for 282 * this field changed. For example, on a {@code LocalDate}, this could be used to 283 * set the year, month or day-of-month. 284 * The returned object has the same observable type as the specified object. 285 * <p> 286 * In some cases, changing a field is not fully defined. For example, if the target object is 287 * a date representing the 31st January, then changing the month to February would be unclear. 288 * In cases like this, the implementation is responsible for resolving the result. 289 * Typically it will choose the previous valid date, which would be the last valid 290 * day of February in this example. 291 * <p> 292 * There are two equivalent ways of using this method. 293 * The first is to invoke this method directly. 294 * The second is to use {@link Temporal#with(TemporalField, long)}: 295 * <pre> 296 * // these two lines are equivalent, but the second approach is recommended 297 * temporal = thisField.adjustInto(temporal); 298 * temporal = temporal.with(thisField); 299 * </pre> 300 * It is recommended to use the second approach, {@code with(TemporalField)}, 301 * as it is a lot clearer to read in code. 302 * <p> 303 * Implementations should perform any queries or calculations using the fields 304 * available in {@link ChronoField}. 305 * If the field is not supported an {@code UnsupportedTemporalTypeException} must be thrown. 306 * <p> 307 * Implementations must not alter the specified temporal object. 308 * Instead, an adjusted copy of the original must be returned. 309 * This provides equivalent, safe behavior for immutable and mutable implementations. 310 * 311 * @param <R> the type of the Temporal object 312 * @param temporal the temporal object to adjust, not null 313 * @param newValue the new value of the field 314 * @return the adjusted temporal object, not null 315 * @throws DateTimeException if the field cannot be set 316 * @throws UnsupportedTemporalTypeException if the field is not supported by the temporal 317 * @throws ArithmeticException if numeric overflow occurs 318 */ 319 <R extends Temporal> R adjustInto(R temporal, long newValue); 320 321 /** 322 * Resolves this field to provide a simpler alternative. 323 * <p> 324 * This method is invoked during the resolve phase of parsing. 325 * It is designed to allow application defined fields to be simplified into 326 * more standard fields, such as those on {@code ChronoField}. 327 * <p> 328 * The method will only be invoked if the specified temporal supports this field. 329 * The value of this field is provided. 330 * <p> 331 * The temporal must be queried using the methods of {@code TemporalAccessor}, 332 * not using {@code getFrom}, {@code isSupportedBy} or {@code rangeRefinedBy}. 333 * Before querying any field, implementations must ensure it is supported, as 334 * exceptions of this type would negatively affect the calculation of a parsed result. 335 * <p> 336 * If this field can resolve, it must return a map, if not it must return null. 337 * The returned map contains the changes to be made to the temporal, expressed 338 * as field-value pairs. If the value for a field is null, the field is to be 339 * removed from the temporal. A null key must not be added to the result map. 340 * <p> 341 * If the result is non-null, this field will be removed from the temporal. 342 * This field should not be added to the result map. 343 * <p> 344 * The {@link ResolverStyle} should be used by implementations to determine 345 * how to perform the resolve. 346 * <p> 347 * The default implementation must return null. 348 * 349 * @param temporal the temporal to resolve, not null 350 * @param value the value of this field 351 * @param resolverStyle the requested type of resolve, not null 352 * @return a map of fields to update in the temporal, with a mapping to null 353 * indicating a deletion. The whole map must be null if no resolving occurred 354 * @throws DateTimeException if resolving results in an error. This must not be thrown 355 * by querying a field on the temporal without first checking if it is supported 356 * @throws ArithmeticException if numeric overflow occurs 357 */ 358 default Map<TemporalField, Long> resolve( 359 TemporalAccessor temporal, long value, ResolverStyle resolverStyle) { 360 return null; 361 } 362 363 } |