Interface OrdinalWeekdayElement<T>

Type Parameters:
T - generic type of calendar chronology
All Superinterfaces:
ChronoElement<Integer>, Comparator<ChronoDisplay>, StdCalendarElement<Integer,​T>

public interface OrdinalWeekdayElement<T> extends StdCalendarElement<Integer,​T>

The element for the ordinal weekday in month.

This interface offers additional operators for setting the weekday in month.

Since:
3.33/4.28
Author:
Meno Hochschild
  • Method Details

    • setToFirst

      ChronoOperator<T> setToFirst(Weekday dayOfWeek)

      Defines an operator which moves a date to the first given weekday in month.

      Equivalent to setTo(1, dayOfWeek).

      Parameters:
      dayOfWeek - first day of week in month
      Returns:
      lenient operator
    • setToLast

      ChronoOperator<T> setToLast(Weekday dayOfWeek)

      Defines an operator which moves a date to the last given weekday in month.

      Equivalent to setTo(Integer.MAX_VALUE, dayOfWeek). The new day will never be in next month.

      Parameters:
      dayOfWeek - last day of week in month
      Returns:
      lenient operator
    • setTo

      ChronoOperator<T> setTo(int ordinal, Weekday dayOfWeek)

      Defines an operator which moves a date to the given ordinal weekday in month.

      If given ordinal number is Integer.MAX_VALUE then the last weekday in month will be determined. This operator behaves in a lenient way, any overflow of the ordinal number will be transferred to another month. Note that this behaviour will also happen if the current month might be shorter than a full calendar week as exotic edge case.

      Parameters:
      ordinal - ordinal number
      dayOfWeek - last day of week in month
      Returns:
      lenient operator