Interface HolidayModel
- All Superinterfaces:
ChronoCondition<PlainDate>,Predicate<PlainDate>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents a rule how to find a non-business day.
- Since:
- 4.24
- Author:
- Meno Hochschild
- See Also:
DateInterval.streamExcluding(Predicate)
-
Method Summary
Modifier and TypeMethodDescriptiondefault IsoDateUnitCreates a special time unit for the counting of business days.default ChronoFunction<ChronoInterval<PlainDate>,Integer>Queries the count of business days in an arbitrary date interval.default ChronoFunction<ChronoInterval<PlainDate>,Integer>Queries the count of non-business days in an arbitrary date interval.default ChronoFunction<ChronoInterval<PlainDate>,PlainDate>Queries the first business day in an arbitrary date interval.default ChronoCondition<PlainDate>Queries if a given date is the first business day of month.default booleanisBusinessDay(PlainDate date)Queries if given date is a business day.default ChronoFunction<ChronoInterval<PlainDate>,PlainDate>Queries the last business day in an arbitrary date interval.default ChronoCondition<PlainDate>Queries if a given date is the last business day of month.default ChronoOperator<PlainDate>Determines the next business day.default ChronoOperator<PlainDate>Determines the same or next business day.static HolidayModelDetermines Saturday and Sunday as non-business days.static HolidayModelDetermines a country-specific weekend as non-business days.default ChronoOperator<PlainDate>Determines the previous business day.default ChronoOperator<PlainDate>Determines the same or previous business day.booleanQueries if given date is a non-business day.
-
Method Details
-
test
Queries if given date is a non-business day.
-
isBusinessDay
Queries if given date is a business day.
Equivalent to
!test(date).- Parameters:
date- the calendar date to be queried- Returns:
trueif the date is a business day elsefalse(holiday or weekend)
-
ofSaturdayOrSunday
Determines Saturday and Sunday as non-business days.
- Returns:
- HolidayModel
-
ofWeekend
Determines a country-specific weekend as non-business days.
- Parameters:
country- locale with country information- Returns:
- HolidayModel
- See Also:
Weekmodel.weekend()
-
nextBusinessDay
Determines the next business day.
Example skipping a weekend:
PlainDate date = PlainDate.of(2017, 2, 3); // Friday date = date.with(HolidayModel.ofSaturdayOrSunday().nextBusinessDay()); System.out.println(date); // 2017-02-06 (Monday)- Returns:
- new date operator
- See Also:
nextOrSameBusinessDay(),previousOrSameBusinessDay(),previousBusinessDay()
-
nextOrSameBusinessDay
Determines the same or next business day.
- Returns:
- new date operator
- See Also:
nextBusinessDay(),previousBusinessDay(),previousOrSameBusinessDay()
-
previousBusinessDay
Determines the previous business day.
- Returns:
- new date operator
- See Also:
nextBusinessDay(),nextOrSameBusinessDay(),previousOrSameBusinessDay()
-
previousOrSameBusinessDay
Determines the same or previous business day.
- Returns:
- new date operator
- See Also:
nextBusinessDay(),nextOrSameBusinessDay(),previousBusinessDay()
-
firstBusinessDay
Queries the first business day in an arbitrary date interval.
- Returns:
- ChronoFunction which can either yield
nullif the first business day does not exist or throws an exception if applied on an infinite interval - See Also:
IsoInterval.get(ChronoFunction),lastBusinessDay()
-
lastBusinessDay
Queries the last business day in an arbitrary date interval.
Following example shows the last Friday in a month:
PlainDate date = CalendarMonth.of(2017, 4).get(HolidayModel.ofSaturdayOrSunday().lastBusinessDay()); System.out.println(date); // 2017-04-28 (Friday)- Returns:
- ChronoFunction which can either yield
nullif the last business day does not exist or throws an exception if applied on an infinite interval - See Also:
IsoInterval.get(ChronoFunction),firstBusinessDay()
-
countOfBusinessDays
Queries the count of business days in an arbitrary date interval.
Example:
int count = CalendarMonth.of(2017, 1).get(HolidayModel.ofSaturdayOrSunday().countOfBusinessDays()); // 22- Returns:
- ChronoFunction counting business days which throws an exception if applied on an infinite interval
- See Also:
IsoInterval.get(ChronoFunction)
-
countOfHolidays
Queries the count of non-business days in an arbitrary date interval.
- Returns:
- ChronoFunction counting free days which throws an exception if applied on an infinite interval
- See Also:
IsoInterval.get(ChronoFunction)
-
firstBusinessDayInMonth
Queries if a given date is the first business day of month.
- Returns:
- ChronoCondition
- See Also:
ChronoEntity.matches(ChronoCondition),lastBusinessDayInMonth()
-
lastBusinessDayInMonth
Queries if a given date is the last business day of month.
Example:
PlainDate date = PlainDate.of(2017, 4, 28); System.out.println(date.matches(HolidayModel.ofSaturdayOrSunday().lastBusinessDayInMonth())); // true- Returns:
- ChronoCondition
- See Also:
ChronoEntity.matches(ChronoCondition),firstBusinessDayInMonth()
-
businessDays
Creates a special time unit for the counting of business days.
Only applicable on the types
PlainDateandPlainTimestamp.- Returns:
- IsoDateUnit
-