A date in the British Cutover calendar system. This date operates using the plain HybridChronology British Cutover calendar. Implementation Requirements This class is immutable and thread-safe. This class must be treated as a value type. Do not synchronize, rely on the ident
| 55 | * identity hash code or use the distinction between equals() and ==. |
| 56 | */ |
| 57 | public final class HybridDate |
| 58 | extends AbstractDate |
| 59 | implements ChronoLocalDate, Serializable { |
| 60 | /** |
| 61 | * Serialization version. |
| 62 | */ |
| 63 | private static final long serialVersionUID = -9626278512674L; |
| 64 | /** |
| 65 | * The underlying date. |
| 66 | */ |
| 67 | private final LocalDate isoDate; |
| 68 | /** |
| 69 | * The underlying Julian date if before the cutover. |
| 70 | */ |
| 71 | private final transient JulianDate julianDate; |
| 72 | |
| 73 | //----------------------------------------------------------------------- |
| 74 | |
| 75 | /** |
| 76 | * Obtains the current {@code HybridDate} from the system clock in the default time-zone. |
| 77 | * <p> |
| 78 | * This will query the {@link Clock#systemDefaultZone() system clock} in the default |
| 79 | * time-zone to obtain the current date. |
| 80 | * <p> |
| 81 | * Using this method will prevent the ability to use an alternate clock for testing |
| 82 | * because the clock is hard-coded. |
| 83 | * |
| 84 | * @return the current date using the system clock and default time-zone, not null |
| 85 | */ |
| 86 | public static HybridDate now() { |
| 87 | return now(Clock.systemDefaultZone()); |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Obtains the current {@code HybridDate} from the system clock in the specified time-zone. |
| 92 | * <p> |
| 93 | * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current date. |
| 94 | * Specifying the time-zone avoids dependence on the default time-zone. |
| 95 | * <p> |
| 96 | * Using this method will prevent the ability to use an alternate clock for testing |
| 97 | * because the clock is hard-coded. |
| 98 | * |
| 99 | * @param zone the zone ID to use, not null |
| 100 | * @return the current date using the system clock, not null |
| 101 | */ |
| 102 | public static HybridDate now(ZoneId zone) { |
| 103 | return now(Clock.system(zone)); |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * Obtains the current {@code HybridDate} from the specified clock. |
| 108 | * <p> |
| 109 | * This will query the specified clock to obtain the current date - today. |
| 110 | * Using this method allows the use of an alternate clock for testing. |
| 111 | * The alternate clock may be introduced using {@linkplain Clock dependency injection}. |
| 112 | * |
| 113 | * @param clock the clock to use, not null |
| 114 | * @return the current date, not null |
nothing calls this directly
no outgoing calls
no test coverage detected