/** * Obtains a local date in Hijrah calendar system from the proleptic-year and day-of-year fields. * * @param prolepticYear the proleptic-year * @param dayOfYear the day-of-year * @return the Hijrah local date, not null * @throws DateTimeException if the value of the year is out of range, or if the day-of-year is * invalid for the year */ @Override public HijrahDate dateYearDay(int prolepticYear, int dayOfYear) { HijrahDate date = HijrahDate.of(this, prolepticYear, 1, 1); if (dayOfYear > date.lengthOfYear()) { throw new DateTimeException("Invalid dayOfYear: " + dayOfYear); } return date.plusDays(dayOfYear - 1); }
@Override public HijrahDate date(TemporalAccessor temporal) { if (temporal instanceof HijrahDate) { return (HijrahDate) temporal; } return HijrahDate.ofEpochDay(this, temporal.getLong(EPOCH_DAY)); }
/** * Obtains a local date in the Hijrah calendar system from the epoch-day. * * @param epochDay the epoch day * @return the Hijrah local date, not null * @throws DateTimeException if unable to create the date */ @Override // override with covariant return type public HijrahDate dateEpochDay(long epochDay) { return HijrahDate.ofEpochDay(this, epochDay); }
/** * Obtains a local date in Hijrah calendar system from the proleptic-year, month-of-year and * day-of-month fields. * * @param prolepticYear the proleptic-year * @param month the month-of-year * @param dayOfMonth the day-of-month * @return the Hijrah local date, not null * @throws DateTimeException if unable to create the date */ @Override public HijrahDate date(int prolepticYear, int month, int dayOfMonth) { return HijrahDate.of(this, prolepticYear, month, dayOfMonth); }