public final class CalendricalMatchers extends Object
CalendricalMatcher
.
These matchers are useful and common implementations of CalendricalMatcher
.
A matcher allows any type of matching to be performed against a calendrical.
Examples might be checking of the calendrical represents Friday the Thirteenth,
or the last day of the month, or one of the American continent time-zones.
CalendricalMatchers is a utility class. All matchers returned are immutable and thread-safe.
Modifier and Type | Method and Description |
---|---|
static CalendricalMatcher |
dayOfWeekInMonth(int ordinal,
DayOfWeek dayOfWeek)
Returns the day-of-week in month matcher, which returns true if the
date is the ordinal occurrence of the day-of-week in the month.
|
static CalendricalMatcher |
firstInMonth(DayOfWeek dayOfWeek)
Returns the first in month matcher, which returns true if the date
is the first occurrence of day-of-week in the month.
|
static CalendricalMatcher |
lastDayOfMonth()
Returns the last day-of-month matcher, which returns true if the date
is the last valid day of the month.
|
static CalendricalMatcher |
lastDayOfYear()
Returns the last day-of-year matcher, which returns true if the date is
the last valid day of the year.
|
static CalendricalMatcher |
leapDay()
Returns the leap day matcher, which returns true if the date
is February 29th in a leap year.
|
static CalendricalMatcher |
leapYear()
Returns the leap year matcher, which returns true if the date
is in a leap year.
|
static CalendricalMatcher |
nonWeekendDay()
Returns the non weekend day matcher, which returns true if the date
is between Monday and Friday inclusive.
|
static CalendricalMatcher |
weekendDay()
Returns the weekend day matcher, which returns true if the date
is Saturday or Sunday.
|
public static CalendricalMatcher leapYear()
public static CalendricalMatcher leapDay()
public static CalendricalMatcher lastDayOfMonth()
public static CalendricalMatcher lastDayOfYear()
public static CalendricalMatcher weekendDay()
Some territories have weekends that do not consist of Saturday and Sunday. No implementation is supplied to support this, however a DateMatcher can be easily written to do so.
public static CalendricalMatcher nonWeekendDay()
Some territories have weekends that do not consist of Saturday and Sunday. No implementation is supplied to support this, however a DateMatcher can be easily written to do so.
public static CalendricalMatcher firstInMonth(DayOfWeek dayOfWeek)
dayOfWeek
- the day-of-week, not nullpublic static CalendricalMatcher dayOfWeekInMonth(int ordinal, DayOfWeek dayOfWeek)
ordinal
- ordinal, from 1 to 5dayOfWeek
- the day-of-week, not nullIllegalArgumentException
- if the ordinal is invalidCopyright © 2014. All rights reserved.