| 1382 | * @since 4.18 |
| 1383 | */ |
| 1384 | public PlainDate plus( |
| 1385 | long amount, |
| 1386 | CalendarUnit unit |
| 1387 | ) { |
| 1388 | |
| 1389 | if (unit == null) { |
| 1390 | throw new NullPointerException("Missing unit."); |
| 1391 | } else if (amount == 0) { |
| 1392 | return this; |
| 1393 | } |
| 1394 | |
| 1395 | try { |
| 1396 | return PlainDate.doAdd(unit, this, amount, OverflowUnit.POLICY_PREVIOUS_VALID_DATE); |
| 1397 | } catch (IllegalArgumentException iae) { |
| 1398 | ArithmeticException ex = new ArithmeticException("Result beyond boundaries of time axis."); |
| 1399 | ex.initCause(iae); |
| 1400 | throw ex; |
| 1401 | } |
| 1402 | |
| 1403 | } |
| 1404 | |
| 1405 | /** |
| 1406 | * <p>Subtracts given amount in units from this date and yields the result of subtraction. </p> |