| 1387 | * @since 4.19 |
| 1388 | */ |
| 1389 | public PlainTime plus( |
| 1390 | long amount, |
| 1391 | ClockUnit unit |
| 1392 | ) { |
| 1393 | |
| 1394 | if (unit == null) { |
| 1395 | throw new NullPointerException("Missing unit."); |
| 1396 | } else if (amount == 0) { |
| 1397 | return this; |
| 1398 | } |
| 1399 | |
| 1400 | try { |
| 1401 | return ClockUnitRule.doAdd(PlainTime.class, unit, this, amount); |
| 1402 | } catch (IllegalArgumentException iae) { |
| 1403 | ArithmeticException ex = new ArithmeticException("Result beyond boundaries of time axis."); |
| 1404 | ex.initCause(iae); |
| 1405 | throw ex; |
| 1406 | } |
| 1407 | |
| 1408 | } |
| 1409 | |
| 1410 | /** |
| 1411 | * <p>Subtracts given amount in units from this clock time and yields the result of subtraction. </p> |