Package com.timeanddate.services
Class HolidaysService
java.lang.Object
com.timeanddate.services.BaseService
com.timeanddate.services.HolidaysService
- Author:
- Cato Auestad <cato@timeanddate.com>
-
Field Summary
Fields inherited from class com.timeanddate.services.BaseService
Language, ServiceName, Version
-
Constructor Summary
ConstructorsConstructorDescriptionHolidaysService(String accessKey, String secretKey)
The holidays service can be used to retrieve the list of holidays for a country. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addHolidayType(HolidayType type)
holidaysForCountry(String country)
The holidays service can be used to retrieve the list of holidays for a country.holidaysForCountry(String countryCode, int year)
The holidays service can be used to retrieve the list of holidays for a country.void
setHolidayTypes(EnumSet<HolidayType> types)
-
Constructor Details
-
HolidaysService
The holidays service can be used to retrieve the list of holidays for a country.- Parameters:
accessKey
- Access key.secretKey
- Secret key.- Throws:
AuthenticationException
- Encryption of the authentication failed
-
-
Method Details
-
holidaysForCountry
public List<Holiday> holidaysForCountry(String countryCode, int year) throws IllegalArgumentException, ServerSideExceptionThe holidays service can be used to retrieve the list of holidays for a country.- Parameters:
countryCode
- Specify the ISO3166-1-alpha-2 Country Code for which you would like to retrieve the list of holidays.year
- The year for which the holidays should be retrieved.- Returns:
- List of holidays for a given country
- Throws:
ServerSideException
- The server produced an error messageIllegalArgumentException
- A required argument was not as expected
-
holidaysForCountry
public List<Holiday> holidaysForCountry(String country) throws IllegalArgumentException, ServerSideExceptionThe holidays service can be used to retrieve the list of holidays for a country. This overload uses the current year by default.- Parameters:
country
- Specify the ISO3166-1-alpha-2 Country Code for which you would like to retrieve the list of holidays.- Returns:
- Throws:
ServerSideException
- The server produced an error messageIllegalArgumentException
- A required argument was not as expected
-
setHolidayTypes
-
addHolidayType
-
getHolidayTypes
-