Skip to content

Commit

Permalink
Merge pull request #684 from focus-shift/682-remove-get-holidays-with…
Browse files Browse the repository at this point in the history
…-int

Remove deprecated 'getHolidays(int year, ...)' method
  • Loading branch information
derTobsch authored Dec 4, 2024
2 parents e95a294 + 456180f commit 2e765e6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,18 +254,6 @@ public ManagerParameter getManagerParameter() {
return managerParameter;
}

/**
* Returns the holidays for the requested year and hierarchy structure.
*
* @param year i.e. 2010
* @param args i.e. args = {'ny'}. returns US/New York holidays. No args means holidays common to whole country
* @return a set of holidays for the requested year
*
* @deprecated in favor of <code>getHolidays(final Year year, final String... args)</code>
*/
@Deprecated(forRemoval = true, since = "0.31.0")
public abstract Set<Holiday> getHolidays(final int year, final String... args);

/**
* Returns the holidays for the requested year and hierarchy structure.
*
Expand All @@ -275,19 +263,6 @@ public ManagerParameter getManagerParameter() {
*/
public abstract Set<Holiday> getHolidays(final Year year, final String... args);

/**
* Returns the holidays for the requested year, the given {@link HolidayType} and the hierarchy structure
*
* @param year i.e. 2010
* @param holidayType a {@link HolidayType} to be considered
* @param args i.e. args = {'ny'}. returns US/New York holidays. No args means holidays common to whole country
* @return a set of holidays of the given {@link HolidayType} for the requested year
*
* @deprecated in favor of <code>getHolidays(final Year year, final HolidayType holidayType, final String... args);</code>
*/
@Deprecated(forRemoval = true, since = "0.31.0")
public abstract Set<Holiday> getHolidays(final int year, final HolidayType holidayType, final String... args);

/**
* Returns the holidays for the requested year, the given {@link HolidayType} and the hierarchy structure
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,6 @@ public void doInit() {
logHierarchy(configuration, 0);
}

/**
* {@inheritDoc}
* <p>
* Calls
* <code>Set&lt;LocalDate&gt; getHolidays(Year year, Configuration c, String... args)</code>
* with the configuration from initialization.
*/
@Override
public Set<Holiday> getHolidays(final int year, final String... args) {
return getHolidays(Year.of(year), args);
}

/**
* {@inheritDoc}
* <p>
Expand Down Expand Up @@ -126,14 +114,6 @@ public Set<Holiday> createValue() {
return holidayCache.get(holidayValueHandler);
}

/**
* {@inheritDoc}
*/
@Override
public Set<Holiday> getHolidays(final int year, final HolidayType holidayType, final String... args) {
return getHolidays(Year.of(year), holidayType, args);
}

/**
* {@inheritDoc}
*/
Expand All @@ -157,7 +137,8 @@ public Set<Holiday> getHolidays(final LocalDate startDateInclusive, final LocalD
Objects.requireNonNull(endDateInclusive, "endDateInclusive is null");

return rangeClosed(startDateInclusive.getYear(), endDateInclusive.getYear())
.mapToObj(year -> getHolidays(year, args))
.mapToObj(Year::of)
.map(year -> getHolidays(year, args))
.flatMap(Collection::stream)
.filter(holiday -> !startDateInclusive.isAfter(holiday.getDate()) && !endDateInclusive.isBefore(holiday.getDate()))
.collect(toUnmodifiableSet());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,6 @@ public class JapaneseHolidayManager extends DefaultHolidayManager {
*/
private static final String BRIDGING_HOLIDAY_PROPERTIES_KEY = "BRIDGING_HOLIDAY";

/**
* {@inheritDoc}
* <p>
* Implements the rule which requests if two holidays have one non holiday
* between each other than this day is also a holiday.
*
* @deprecated in favor of <code>getHolidays(final Year year, final String... args)</code>
*/
@Deprecated(forRemoval = true, since = "0.31.0")
@Override
public Set<Holiday> getHolidays(final int year, final String... args) {
return getHolidays(Year.of(year), args);
}

/**
* {@inheritDoc}
* <p>
Expand Down

0 comments on commit 2e765e6

Please sign in to comment.