Interface HijriData


public interface HijriData

Generic interface for loading and representing any local variant of Hijri data.

Typical implementations might be based either on file resources or on SQL databases. A sensible approach looks such that a database table has 12 columns where every cell contains the length of month in the associated Hijri year (per row).

Since:
5.6
Author:
Meno Hochschild
  • Method Summary

    Modifier and Type
    Method
    Description
    Obtains the gregorian date of first day and month in minimum Hijri year.
    int
    lengthOfMonth​(int hijriYear, int hijriMonth)
    Obtains the length of given month in days.
    int
    Obtains the maximum supported Hijri year.
    int
    Obtains the minimum supported Hijri year.
    Obtains the name of the associated Hijri calendar variant.
    void
    Initializes the data.
    default String
    Determines the data version (optional).
  • Method Details

    • prepare

      void prepare()

      Initializes the data.

      This method will be called by Time4J every time when the data have to be registered. A typical implementation might read a SQL database and load an internal array cache in order to avoid excessive calls of database.

      Throws:
      IllegalStateException - if the initialization fails
      See Also:
      HijriCalendar.register(HijriData)
    • name

      String name()

      Obtains the name of the associated Hijri calendar variant.

      The full calendar type is created by prefixing the name with "islamic-". For example: The calendar of Saudi-Arabia with the name "umalqura" has the calendar type and full variant name "islamic-umalqura".

      Returns:
      String which must not start with prefix "islamic"
    • version

      default String version()

      Determines the data version (optional).

      This method serves for data analysis only.

      Returns:
      version info (maybe empty if not relevant)
    • minimumYear

      int minimumYear()

      Obtains the minimum supported Hijri year.

      Returns:
      smallest supported Hijri year
    • maximumYear

      int maximumYear()

      Obtains the maximum supported Hijri year.

      Returns:
      biggest supported Hijri year
    • firstGregorianDate

      PlainDate firstGregorianDate()

      Obtains the gregorian date of first day and month in minimum Hijri year.

      Returns:
      PlainDate
    • lengthOfMonth

      int lengthOfMonth(int hijriYear, int hijriMonth)

      Obtains the length of given month in days.

      The hijriYear-parameter is always in the range minimumYear()-maximumYear().

      Parameters:
      hijriYear - the Hijri year which contains the month in question
      hijriMonth - the Hijri month in the range 1-12
      Returns:
      length of month (usually 29 or 30)
      See Also:
      minimumYear(), maximumYear()