Adds this duration to a {@link Calendar} object.
Calls {@link java.util.Calendar#add(int,int)} in theorder of YEARS, MONTHS, DAYS, HOURS, MINUTES, SECONDS, and MILLISECONDS if those fields are present. Because the {@link Calendar} classuses int to hold values, there are cases where this method won't work correctly (for example if values of fields exceed the range of int.)
Also, since this duration class is a Gregorian duration, this method will not work correctly if the given {@link Calendar}object is based on some other calendar systems.
Any fractional parts of this Duration
object beyond milliseconds will be simply ignored. For example, if this duration is "P1.23456S", then 1 is added to SECONDS, 234 is added to MILLISECONDS, and the rest will be unused.
Note that because {@link Calendar#add(int,int)} is usingint, Duration
with values beyond the range of int in its fields will cause overflow/underflow to the given {@link Calendar}. {@link XMLGregorianCalendar#add(Duration)} provides the samebasic operation as this method while avoiding the overflow/underflow issues.
@param calendar A calendar object whose value will be modified.
@throws NullPointerException if the calendar parameter is null.