Record Class NaftahDate.Calendar

java.lang.Object
java.lang.Record
org.daiitech.naftah.builtin.time.NaftahDate.Calendar
Record Components:
calendar - the name of the calendar
chronology - the associated Chronology
Enclosing class:
NaftahDate

public static record NaftahDate.Calendar(String calendar, Chronology chronology) extends Record
Represents an Naftah calendar specification.

If no chronology or calendar name is provided, default values are applied automatically.

This component is optional and may be omitted in date expressions.

  • Field Details

    • calendar

      private final String calendar
      The field for the calendar record component.
    • chronology

      private final Chronology chronology
      The field for the chronology record component.
  • Constructor Details

    • Calendar

      public Calendar(String calendar, Chronology chronology)
      Creates an instance of a Calendar record class.
      Parameters:
      calendar - the value for the calendar record component
      chronology - the value for the chronology record component
  • Method Details

    • of

      public static NaftahDate.Calendar of(String calendar, Chronology chronology)
      Creates a Calendar instance using the given name and chronology.
      Parameters:
      calendar - the calendar name
      chronology - the associated chronology
      Returns:
      a new Calendar instance
    • of

      public static NaftahDate.Calendar of(Chronology chronology)
      Creates a Calendar instance using only a chronology. The calendar name will default automatically.
      Parameters:
      chronology - the associated chronology
      Returns:
      a new Calendar instance
    • toString

      public String toString()
      Returns a string representation of this NaftahDate.Calendar in the format: "Calendar: calendar".

      Displays the name of the calendar. If no name was provided, the default calendar name is used.

      Specified by:
      toString in class Record
      Returns:
      a formatted string representing the calendar
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • calendar

      public String calendar()
      Returns the value of the calendar record component.
      Returns:
      the value of the calendar record component
    • chronology

      public Chronology chronology()
      Returns the value of the chronology record component.
      Returns:
      the value of the chronology record component