Class CommonElements

java.lang.Object
net.time4j.calendar.CommonElements

public class CommonElements extends Object

Defines access to elements which can be used by all calendars defined in this package.

Since:
3.20/4.16
Author:
Meno Hochschild
  • Field Details

  • Method Details

    • localDayOfWeek

      @FormattableElement(format="e", alt="c") public static <T extends ChronoEntity<T> & CalendarDate> StdCalendarElement<Weekday,​T> localDayOfWeek(Chronology<T> chronology, Weekmodel model)

      Defines an element for the weekday with a localized day number in the value range 1-7.

      The given chronology must support a 7-day-week with an element of name "DAY_OF_WEEK" otherwise an exception will be thrown.

      This element defines localized weekday numbers in numerical formatting and also a localized sorting order of weekdays, but still manages values of type Weekday. However, the value range with its minimum and maximum is localized, too, i.e. the element defines as minium the value getFirstDayOfWeek().

      Type Parameters:
      T - chronological type
      Parameters:
      chronology - the calendrical chronology
      model - the underlying week model
      Returns:
      day of week with localized order
      Throws:
      IllegalArgumentException - if the chronology does not support this element
      Since:
      3.24/4.20
    • weekOfYear

      @FormattableElement(format="w") public static <T extends ChronoEntity<T> & CalendarDate> StdCalendarElement<Integer,​T> weekOfYear(Chronology<T> chronology, Weekmodel model)

      Creates an integer element for the week of year in given chronology dependent on given week model.

      The given chronology must support a 7-day-week with elements of names "DAY_OF_WEEK" and "DAY_OF_YEAR", otherwise an exception will be thrown.

      Type Parameters:
      T - chronological type
      Parameters:
      chronology - the calendrical chronology
      model - the underlying week model
      Returns:
      generic calendar element
      Throws:
      IllegalArgumentException - if the chronology does not support this element
      Since:
      3.24/4.20
    • weekOfMonth

      @FormattableElement(format="W") public static <T extends ChronoEntity<T> & CalendarDate> StdCalendarElement<Integer,​T> weekOfMonth(Chronology<T> chronology, Weekmodel model)

      Creates an integer element for the week of month in given chronology dependent on given week model.

      The given chronology must support a 7-day-week with elements of names "DAY_OF_WEEK" and "DAY_OF_MONTH", otherwise an exception will be thrown.

      Type Parameters:
      T - chronological type
      Parameters:
      chronology - the calendar chronology
      model - the underlying week model
      Returns:
      generic calendar element
      Throws:
      IllegalArgumentException - if the chronology does not support this element
      Since:
      3.24/4.20
    • boundedWeekOfYear

      public static <T extends ChronoEntity<T> & CalendarDate> StdCalendarElement<Integer,​T> boundedWeekOfYear(Chronology<T> chronology, Weekmodel model)

      Creates an integer element for the week of year in given chronology dependent on given week model and constrained by year boundaries.

      The given chronology must support a 7-day-week with elements of names "DAY_OF_WEEK" and "DAY_OF_YEAR", otherwise an exception will be thrown.

      Type Parameters:
      T - chronological type
      Parameters:
      chronology - the calendrical chronology
      model - the underlying week model
      Returns:
      generic calendar element
      Throws:
      IllegalArgumentException - if the chronology does not support this element
      Since:
      3.40/4.35
    • boundedWeekOfMonth

      public static <T extends ChronoEntity<T> & CalendarDate> StdCalendarElement<Integer,​T> boundedWeekOfMonth(Chronology<T> chronology, Weekmodel model)

      Creates an integer element for the week of month in given chronology dependent on given week model and constrained by month boundaries.

      The given chronology must support a 7-day-week with elements of names "DAY_OF_WEEK" and "DAY_OF_MONTH", otherwise an exception will be thrown.

      Type Parameters:
      T - chronological type
      Parameters:
      chronology - the calendar chronology
      model - the underlying week model
      Returns:
      generic calendar element
      Throws:
      IllegalArgumentException - if the chronology does not support this element
      Since:
      3.40/4.35