Returns a copy of the specified temporal object with the specified period added.
!(p)
The period added is a multiple of this unit. For example, this method
could be used to add "3 days" to a date by calling this method on the
instance representing "days", passing the date and the period "3".
The period to be added may be negative, which is equivalent to subtraction.
!(p)
There are two equivalent ways of using this method.
The first is to invoke this method directly.
The second is to use {@link Temporal#plus(long, TemporalUnit)}:
!(pre)
// these two lines are equivalent, but the second approach is recommended
temporal = thisUnit.addTo(temporal);
temporal = temporal.plus(thisUnit);
</pre>
It is recommended to use the second approach, {@code plus(TemporalUnit)},
as it is a lot clearer to read _in code.
!(p)
Implementations should perform any queries or calculations using the units
available _in {@link ChronoUnit} or the fields available _in {@link ChronoField}.
If the unit is not supported an {@code UnsupportedTemporalTypeException} must be thrown.
!(p)
Implementations must not alter the specified temporal object.
Instead, an adjusted copy of the original must be returned.
This provides equivalent, safe behavior for immutable and mutable implementations.
@param !(R) the type of the Temporal object
@param temporal the temporal object to adjust, not null
@param amount the amount of this unit to add, positive or negative
@return the adjusted temporal object, not null
@throws DateTimeException if the amount cannot be added
@throws UnsupportedTemporalTypeException if the unit is not supported by the temporal
Returns a copy of the specified temporal object with the specified period added. !(p) The period added is a multiple of this unit. For example, this method could be used to add "3 days" to a date by calling this method on the instance representing "days", passing the date and the period "3". The period to be added may be negative, which is equivalent to subtraction. !(p) There are two equivalent ways of using this method. The first is to invoke this method directly. The second is to use {@link Temporal#plus(long, TemporalUnit)}: !(pre) // these two lines are equivalent, but the second approach is recommended temporal = thisUnit.addTo(temporal); temporal = temporal.plus(thisUnit); </pre> It is recommended to use the second approach, {@code plus(TemporalUnit)}, as it is a lot clearer to read _in code. !(p) Implementations should perform any queries or calculations using the units available _in {@link ChronoUnit} or the fields available _in {@link ChronoField}. If the unit is not supported an {@code UnsupportedTemporalTypeException} must be thrown. !(p) Implementations must not alter the specified temporal object. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable implementations.
@param !(R) the type of the Temporal object @param temporal the temporal object to adjust, not null @param amount the amount of this unit to add, positive or negative @return the adjusted temporal object, not null @throws DateTimeException if the amount cannot be added @throws UnsupportedTemporalTypeException if the unit is not supported by the temporal