Class HolidaysService

java.lang.Object
com.timeanddate.services.BaseService
com.timeanddate.services.HolidaysService

public class HolidaysService extends BaseService
Author:
Cato Auestad <cato@timeanddate.com>
  • Constructor Details

    • HolidaysService

      public HolidaysService(String accessKey, String secretKey) throws AuthenticationException
      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, ServerSideException
      The 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 message
      IllegalArgumentException - A required argument was not as expected
    • holidaysForCountry

      public List<Holiday> holidaysForCountry(String country) throws IllegalArgumentException, ServerSideException
      The 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 message
      IllegalArgumentException - A required argument was not as expected
    • setHolidayTypes

      public void setHolidayTypes(EnumSet<HolidayType> types)
    • addHolidayType

      public void addHolidayType(HolidayType type)
    • getHolidayTypes

      public EnumSet<HolidayType> getHolidayTypes()