If an implementation represents a field that can be simplified, or combined with others, then this method must be implemented. The specified map contains the current state of the parse. The map is mutable and must be mutated to resolve the field and any related fields. This method will only be invoked during parsing if the map contains this field, and implementations should therefore assume this field is present.
Resolving a field will consist of looking at the value of this field, and potentially other fields, and either updating the map with a simpler value, such as a ChronoField
, or returning a complete ChronoLocalDate
. If a resolve is successful, the code must remove all the fields that were resolved from the map, including this field.
For example, the IsoFields
class contains the quarter-of-year and day-of-quarter fields. The implementation of this method in that class resolves the two fields plus the YEAR
into a complete LocalDate
. The resolve method will remove all three fields from the map before returning the LocalDate
.
A partially complete temporal is used to allow the chronology and zone to be queried. In general, only the chronology will be needed. Querying items other than the zone or chronology is undefined and must not be relied on. The behavior of other methods such as get
, getLong
, range
and isSupported
is unpredictable and the results undefined.
If resolution should be possible, but the data is invalid, the resolver style should be used to determine an appropriate level of leniency, which may require throwing a DateTimeException
or ArithmeticException
. If no resolution is possible, the resolve method must return null.
When resolving time fields, the map will be altered and null returned. When resolving date fields, the date is normally returned from the method, with the map altered to remove the resolved fields. However, it would also be acceptable for the date fields to be resolved into other ChronoField
instances that can produce a date, such as EPOCH_DAY
.
Not all TemporalAccessor
implementations are accepted as return values. Implementations that call this method must accept ChronoLocalDate
, ChronoLocalDateTime
, ChronoZonedDateTime
and LocalTime
.
The default implementation must return null.