60 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
60 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
61 */ |
61 */ |
62 package java.time.temporal; |
62 package java.time.temporal; |
63 |
63 |
64 import java.time.DateTimeException; |
64 import java.time.DateTimeException; |
65 import java.time.ZoneId; |
|
66 import java.time.chrono.Chronology; |
65 import java.time.chrono.Chronology; |
67 import java.time.format.ResolverStyle; |
66 import java.time.format.ResolverStyle; |
68 import java.util.Locale; |
67 import java.util.Locale; |
69 import java.util.Map; |
68 import java.util.Map; |
70 import java.util.Objects; |
69 import java.util.Objects; |
336 * and day-of-quarter fields. The implementation of this method in that class |
335 * and day-of-quarter fields. The implementation of this method in that class |
337 * resolves the two fields plus the {@link ChronoField#YEAR YEAR} into a |
336 * resolves the two fields plus the {@link ChronoField#YEAR YEAR} into a |
338 * complete {@code LocalDate}. The resolve method will remove all three |
337 * complete {@code LocalDate}. The resolve method will remove all three |
339 * fields from the map before returning the {@code LocalDate}. |
338 * fields from the map before returning the {@code LocalDate}. |
340 * <p> |
339 * <p> |
|
340 * A partially complete temporal is used to allow the chronology and zone |
|
341 * to be queried. In general, only the chronology will be needed. |
|
342 * Querying items other than the zone or chronology is undefined and |
|
343 * must not be relied on. |
|
344 * The behavior of other methods such as {@code get}, {@code getLong}, |
|
345 * {@code range} and {@code isSupported} is unpredictable and the results undefined. |
|
346 * <p> |
341 * If resolution should be possible, but the data is invalid, the resolver |
347 * If resolution should be possible, but the data is invalid, the resolver |
342 * style should be used to determine an appropriate level of leniency, which |
348 * style should be used to determine an appropriate level of leniency, which |
343 * may require throwing a {@code DateTimeException} or {@code ArithmeticException}. |
349 * may require throwing a {@code DateTimeException} or {@code ArithmeticException}. |
344 * If no resolution is possible, the resolve method must return null. |
350 * If no resolution is possible, the resolve method must return null. |
345 * <p> |
351 * <p> |
348 * with the map altered to remove the resolved fields. However, it would also |
354 * with the map altered to remove the resolved fields. However, it would also |
349 * be acceptable for the date fields to be resolved into other {@code ChronoField} |
355 * be acceptable for the date fields to be resolved into other {@code ChronoField} |
350 * instances that can produce a date, such as {@code EPOCH_DAY}. |
356 * instances that can produce a date, such as {@code EPOCH_DAY}. |
351 * <p> |
357 * <p> |
352 * Not all {@code TemporalAccessor} implementations are accepted as return values. |
358 * Not all {@code TemporalAccessor} implementations are accepted as return values. |
353 * Implementations must accept {@code ChronoLocalDate}, {@code ChronoLocalDateTime}, |
359 * Implementations that call this method must accept {@code ChronoLocalDate}, |
354 * {@code ChronoZonedDateTime} and {@code LocalTime}. |
360 * {@code ChronoLocalDateTime}, {@code ChronoZonedDateTime} and {@code LocalTime}. |
355 * <p> |
|
356 * The zone is not normally required for resolution, but is provided for completeness. |
|
357 * <p> |
361 * <p> |
358 * The default implementation must return null. |
362 * The default implementation must return null. |
359 * |
363 * |
360 * @param fieldValues the map of fields to values, which can be updated, not null |
364 * @param fieldValues the map of fields to values, which can be updated, not null |
361 * @param chronology the effective chronology, not null |
365 * @param partialTemporal the partially complete temporal to query for zone and |
362 * @param zone the effective zone, not null |
366 * chronology; querying for other things is undefined and not recommended, not null |
363 * @param resolverStyle the requested type of resolve, not null |
367 * @param resolverStyle the requested type of resolve, not null |
364 * @return the resolved temporal object; null if resolving only |
368 * @return the resolved temporal object; null if resolving only |
365 * changed the map, or no resolve occurred |
369 * changed the map, or no resolve occurred |
366 * @throws ArithmeticException if numeric overflow occurs |
370 * @throws ArithmeticException if numeric overflow occurs |
367 * @throws DateTimeException if resolving results in an error. This must not be thrown |
371 * @throws DateTimeException if resolving results in an error. This must not be thrown |
368 * by querying a field on the temporal without first checking if it is supported |
372 * by querying a field on the temporal without first checking if it is supported |
369 */ |
373 */ |
370 default TemporalAccessor resolve( |
374 default TemporalAccessor resolve( |
371 Map<TemporalField, Long> fieldValues, Chronology chronology, |
375 Map<TemporalField, Long> fieldValues, |
372 ZoneId zone, ResolverStyle resolverStyle) { |
376 TemporalAccessor partialTemporal, |
|
377 ResolverStyle resolverStyle) { |
373 return null; |
378 return null; |
374 } |
379 } |
375 |
380 |
376 /** |
381 /** |
377 * Gets a descriptive name for the field. |
382 * Gets a descriptive name for the field. |