public class PublicHolidayAPI extends Object implements HolidaySearcher
app.pickmaven.businessdays.HolidaySearcher interface for getting a list of LocalDate objects representing
the holidays for specific countries using the app.pickmaven.businessdays.PublicHolidayAPI of RapidAPI.
This class is immutable and thread-safe.
| Modifier and Type | Field and Description |
|---|---|
static String |
PUBLIC_HOLIDAY_P_RAPIDAPI_COM
Base endpoint for calling the Rapid Api of Public app.pickmaven.businessdays.Holiday.
|
| Constructor and Description |
|---|
PublicHolidayAPI(String api_key)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
PublicHolidayAPI |
applyPredicate(java.util.function.Predicate<? super com.google.gson.JsonObject> predicate)
Call this method for apply a {@code Predicate
|
List<java.time.LocalDate> |
searchHolidaysFor(String countryCode)
Returns a list of
LocalDate representing the holidays for a specific country. |
List<java.time.LocalDate> |
searchHolidaysFor(String countryCode,
int year)
Returns a list of
LocalDate representing the holidays for a specific country and for specific year. |
public static final String PUBLIC_HOLIDAY_P_RAPIDAPI_COM
public PublicHolidayAPI(String api_key)
api_key - personal api-key, not nullpublic PublicHolidayAPI applyPredicate(java.util.function.Predicate<? super com.google.gson.JsonObject> predicate)
Predicate<? super JsonObject> in order to filter the holidayspredicate - for filtering holidays from the responsepublic List<java.time.LocalDate> searchHolidaysFor(String countryCode) throws IOException
LocalDate representing the holidays for a specific country.
This method assumes you are searching holidays for current year.searchHolidaysFor in interface HolidaySearchercountryCode - the code of country you are searching forIOException - If connection to the api failedpublic List<java.time.LocalDate> searchHolidaysFor(String countryCode, int year) throws IOException
LocalDate representing the holidays for a specific country and for specific year.countryCode - for which search holidaysyear - for which you are searching holidaysIOException - If connection to the api failedCopyright © 2020. All rights reserved.