| 373 | } |
| 374 | |
| 375 | private static class ERule<T extends ChronoEntity<T>> |
| 376 | implements IntElementRule<T> { |
| 377 | |
| 378 | //~ Methoden ------------------------------------------------------ |
| 379 | |
| 380 | @Override |
| 381 | public Integer getValue(T context) { |
| 382 | |
| 383 | return Integer.valueOf(this.getInt(context)); |
| 384 | |
| 385 | } |
| 386 | |
| 387 | @Override |
| 388 | public Integer getMinimum(T context) { |
| 389 | |
| 390 | return YOWElement.INSTANCE.getDefaultMinimum(); |
| 391 | |
| 392 | } |
| 393 | |
| 394 | @Override |
| 395 | public Integer getMaximum(T context) { |
| 396 | |
| 397 | return YOWElement.INSTANCE.getDefaultMaximum(); |
| 398 | |
| 399 | } |
| 400 | |
| 401 | @Override |
| 402 | public boolean isValid( |
| 403 | T context, |
| 404 | Integer value |
| 405 | ) { |
| 406 | |
| 407 | if (value == null) { |
| 408 | return false; |
| 409 | } |
| 410 | |
| 411 | int v = value.intValue(); |
| 412 | |
| 413 | return ( |
| 414 | (v >= GregorianMath.MIN_YEAR) |
| 415 | && (v <= GregorianMath.MAX_YEAR) |
| 416 | ); |
| 417 | |
| 418 | } |
| 419 | |
| 420 | @Override |
| 421 | public T withValue( |
| 422 | T context, |
| 423 | Integer value, |
| 424 | boolean lenient |
| 425 | ) { |
| 426 | |
| 427 | if (value == null) { |
| 428 | throw new IllegalArgumentException("Missing element value."); |
| 429 | } |
| 430 | |
| 431 | PlainDate date = context.get(CALENDAR_DATE); |
| 432 | date = setYearOfWeekdate(date, value.intValue()); |
nothing calls this directly
no outgoing calls
no test coverage detected