Interface CalendricalMatcher

    • Method Detail

      • matchesCalendrical

        boolean matchesCalendrical​(Calendrical calendrical)
        Checks if the input calendrical matches the rules of the implementation.

        This is a strategy pattern that allows a range of matches to be made against a calendrical. A typical implementation will query the calendrical to extract one of more values, and compare or check them in some way.

        For example, an implementation to check if the calendrical represents a Saturday or Sunday:

          public boolean matchesCalendrical(Calendrical calendrical) {
            DayOfWeek dow = calendrical.get(ISOChronology.dayOfWeekRule());
            return dow != null && (dow == DayOfWeek.SATURDAY || dow == DayOfWeek.SUNDAY);
          }
         
        Parameters:
        calendrical - the calendrical to match against, not null
        Returns:
        true if the date matches, false otherwise