@Override // override with covariant return type public MinguoDate date(int prolepticYear, int month, int dayOfMonth) { return new MinguoDate(LocalDate.of(prolepticYear + YEARS_DIFFERENCE, month, dayOfMonth)); }
/** * Obtains the current {@code MinguoDate} from the specified clock. * <p> * This will query the specified clock to obtain the current date - today. * Using this method allows the use of an alternate clock for testing. * The alternate clock may be introduced using {@linkplain Clock dependency injection}. * * @param clock the clock to use, not null * @return the current date, not null * @throws DateTimeException if the current date cannot be obtained */ public static MinguoDate now(Clock clock) { return new MinguoDate(LocalDate.now(clock)); }
@Override // override with covariant return type public MinguoDate date(TemporalAccessor temporal) { if (temporal instanceof MinguoDate) { return (MinguoDate) temporal; } return new MinguoDate(LocalDate.from(temporal)); }
@Override // override with covariant return type public MinguoDate dateYearDay(int prolepticYear, int dayOfYear) { return new MinguoDate(LocalDate.ofYearDay(prolepticYear + YEARS_DIFFERENCE, dayOfYear)); }
@Override public MinguoDate dateEpochDay(long epochDay) { return new MinguoDate(LocalDate.ofEpochDay(epochDay)); }
private MinguoDate with(LocalDate newDate) { return (newDate.equals(isoDate) ? this : new MinguoDate(newDate)); }