Returns an object of the same type as this object with the specified field altered.
!(p)
This returns a new object based on this one with the value for the specified field changed.
For example, on a {@code LocalDate}, this could be used to set the year, month or day-of-month.
The returned object will have the same observable type as this object.
!(p)
In some cases, changing a field is not fully defined. For example, if the target object is
a date representing the 31st January, then changing the month to February would be unclear.
In cases like this, the field is responsible for resolving the result. Typically it will choose
the previous valid date, which would be the last valid day of February _in this example.
@implSpec
Implementations must check and handle all fields defined _in {@link ChronoField}.
If the field is supported, then the adjustment must be performed.
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.adjustInto(Temporal, long)}
passing {@code this} as the first argument.
!(p)
Implementations must not alter this object.
Instead, an adjusted copy of the original must be returned.
This provides equivalent, safe behavior for immutable and mutable implementations.
@param field the field to set _in the result, not null
@param newValue the new value of the field _in the result
@return an object of the same type with the specified field set, not null
@throws DateTimeException if the field cannot be set
@throws UnsupportedTemporalTypeException if the field is not supported
@throws ArithmeticException if numeric overflow occurs
Returns an object of the same type as this object with the specified field altered. !(p) This returns a new object based on this one with the value for the specified field changed. For example, on a {@code LocalDate}, this could be used to set the year, month or day-of-month. The returned object will have the same observable type as this object. !(p) In some cases, changing a field is not fully defined. For example, if the target object is a date representing the 31st January, then changing the month to February would be unclear. In cases like this, the field is responsible for resolving the result. Typically it will choose the previous valid date, which would be the last valid day of February _in this example.
@implSpec Implementations must check and handle all fields defined _in {@link ChronoField}. If the field is supported, then the adjustment must be performed. 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.adjustInto(Temporal, long)} passing {@code this} as the first argument. !(p) Implementations must not alter this object. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable implementations.
@param field the field to set _in the result, not null @param newValue the new value of the field _in the result @return an object of the same type with the specified field set, not null @throws DateTimeException if the field cannot be set @throws UnsupportedTemporalTypeException if the field is not supported @throws ArithmeticException if numeric overflow occurs