Package org.sellcom.geotemporal.time
Class Temporals
- java.lang.Object
-
- org.sellcom.geotemporal.time.Temporals
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intgetIsoWeekNumber(Temporal temporal)Returns the ISO 8601 week number of the given temporal.static booleanisHoliday(Temporal temporal, GeoRegion region, EnumSet<HolidayType> types)Checks whether the given temporal is a holiday of any of the given types in the given region.static booleanisPublicHoliday(Temporal temporal, GeoRegion region)Checks whether the given temporal is a public holiday in the given region.static booleanisSchoolHoliday(Temporal temporal, GeoRegion region)Checks whether the given date is a school holiday in the given region.static booleanisWeekend(Temporal temporal, GeoRegion region)Checks whether the given temporal is a weekend in the given region.static booleanisWorkingDay(Temporal temporal, GeoRegion region)Checks whether the given temporal is a working day in the given region.static voidregisterCustomHolidayPredicate(String countryCode, HolidayPredicate predicate)Registers a custom predicate for determining holidays in the given country.static voidregisterCustomWeekendPredicate(String countryCode, GeoTemporalPredicate predicate)Registers a custom predicate for determining weekends in the given country.static voidregisterCustomWorkingDayPredicate(String countryCode, GeoTemporalPredicate predicate)Registers a custom predicate for determining working days in the given country.
-
-
-
Method Detail
-
getIsoWeekNumber
public static int getIsoWeekNumber(Temporal temporal)
Returns the ISO 8601 week number of the given temporal.- Throws:
IllegalArgumentException- iftemporalisnull- Since:
- 1.0
-
isHoliday
public static boolean isHoliday(Temporal temporal, GeoRegion region, EnumSet<HolidayType> types)
Checks whether the given temporal is a holiday of any of the given types in the given region.- Throws:
IllegalArgumentException- iftemporalisnullIllegalArgumentException- ifregionisnullIllegalArgumentException- iftypesisnullGeoRegionNotSupportedException- if the region is not supported- Since:
- 1.0
-
isPublicHoliday
public static boolean isPublicHoliday(Temporal temporal, GeoRegion region)
Checks whether the given temporal is a public holiday in the given region.Only considers public holidays (
HolidayType.PUBLIC). To customise the holiday types, useisHoliday(Temporal, GeoRegion, EnumSet)instead.- Throws:
IllegalArgumentException- iftemporalisnullIllegalArgumentException- ifregionisnullGeoRegionNotSupportedException- if the region is not supported- Since:
- 1.0
-
isSchoolHoliday
public static boolean isSchoolHoliday(Temporal temporal, GeoRegion region)
Checks whether the given date is a school holiday in the given region.Only considers school holidays (
HolidayType.SCHOOLS_AND_UNIVERSITIES_ONLYandHolidayType.SCHOOLS_ONLY). To customise the holiday types, useisHoliday(Temporal, GeoRegion, EnumSet)instead.- Throws:
IllegalArgumentException- iftemporalisnullIllegalArgumentException- ifregionisnullGeoRegionNotSupportedException- if the region is not supported- Since:
- 1.0
-
isWeekend
public static boolean isWeekend(Temporal temporal, GeoRegion region)
Checks whether the given temporal is a weekend in the given region.- Throws:
IllegalArgumentException- iftemporalisnullIllegalArgumentException- ifregionisnullGeoRegionNotSupportedException- if the region is not supported- Since:
- 1.0
-
isWorkingDay
public static boolean isWorkingDay(Temporal temporal, GeoRegion region)
Checks whether the given temporal is a working day in the given region.- Throws:
IllegalArgumentException- iftemporalisnullIllegalArgumentException- ifregionisnullGeoRegionNotSupportedException- if the region is not supported- Since:
- 1.0
-
registerCustomHolidayPredicate
public static void registerCustomHolidayPredicate(String countryCode, HolidayPredicate predicate)
Registers a custom predicate for determining holidays in the given country.- Throws:
IllegalArgumentException- ifcountryCodeisnullIllegalArgumentException- ifpredicateisnull- Since:
- 1.0
-
registerCustomWeekendPredicate
public static void registerCustomWeekendPredicate(String countryCode, GeoTemporalPredicate predicate)
Registers a custom predicate for determining weekends in the given country.- Throws:
IllegalArgumentException- ifcountryCodeisnullIllegalArgumentException- ifpredicateisnull- Since:
- 1.0
-
registerCustomWorkingDayPredicate
public static void registerCustomWorkingDayPredicate(String countryCode, GeoTemporalPredicate predicate)
Registers a custom predicate for determining working days in the given country.- Throws:
IllegalArgumentException- ifcountryCodeisnullIllegalArgumentException- ifpredicateisnull- Since:
- 1.0
-
-