Class TimeZoneMapping


  • public final class TimeZoneMapping
    extends java.lang.Object
    Mapping of Firebird time zone ids.
    Since:
    4.0
    Author:
    Mark Rotteveel
    • Constructor Summary

      Constructors 
      Constructor Description
      TimeZoneMapping()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static TimeZoneMapping getInstance()  
      boolean isOffsetTimeZone​(int timeZoneId)
      Determines if timeZoneId is an offset time zone or - possibly - a named time zone.
      boolean isSupportedOffsetTimezone​(int timeZoneId)
      Determines if timeZoneId is an offset time zone in the range supported by Jaybird [-18:00, +18:00].
      java.time.ZoneId timeZoneById​(int timeZoneId)
      Maps a Firebird time zone id to a suitable Java ZoneId.
      int toOffsetMinutes​(int timeZoneId)
      Return the offset in minutes for an offset time zone id
      int toTimeZoneId​(int offsetMinutes)
      Return the Firebird time zone id for an offset in minutes.
      int toTimeZoneId​(java.time.ZoneId zoneId)
      Returns the Firebird time zone id for a ZoneId.
      int toTimeZoneId​(java.time.ZoneOffset zoneOffset)
      Returns the Firebird time zone id for a ZoneOffset.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TimeZoneMapping

        public TimeZoneMapping()
    • Method Detail

      • timeZoneById

        public java.time.ZoneId timeZoneById​(int timeZoneId)
        Maps a Firebird time zone id to a suitable Java ZoneId.

        The returned value is either a named time zone (zone region), or an offset zone (ZoneOffset).

        Parameters:
        timeZoneId - Firebird time zone id (valid between between 0 and 65535)
        Returns:
        java.time.Zone equivalent (out of range values or unmapped ids will return UTC).
      • isOffsetTimeZone

        public boolean isOffsetTimeZone​(int timeZoneId)
        Determines if timeZoneId is an offset time zone or - possibly - a named time zone.
        Parameters:
        timeZoneId - Firebird time zone id
        Returns:
        true if this is an offset time zone, false otherwise
      • isSupportedOffsetTimezone

        public boolean isSupportedOffsetTimezone​(int timeZoneId)
        Determines if timeZoneId is an offset time zone in the range supported by Jaybird [-18:00, +18:00].
        Parameters:
        timeZoneId - Firebird time zone id
        Returns:
        true if this is an offset time zone in the range [-18:00, +18:00]
      • toOffsetMinutes

        public int toOffsetMinutes​(int timeZoneId)
        Return the offset in minutes for an offset time zone id
        Parameters:
        timeZoneId - Offset time zone id (in range [0, 2878])
        Returns:
        Offset in minutes, out of range values for timeZoneId will return 0 for UTC/GMT.
      • toTimeZoneId

        public int toTimeZoneId​(java.time.ZoneOffset zoneOffset)
        Returns the Firebird time zone id for a ZoneOffset.
        Parameters:
        zoneOffset - The zone offset
        Returns:
        Firebird time zone id
        See Also:
        toTimeZoneId(ZoneId)
      • toTimeZoneId

        public int toTimeZoneId​(java.time.ZoneId zoneId)
        Returns the Firebird time zone id for a ZoneId.

        This method handles both ZoneOffset and named regions.

        Parameters:
        zoneId - The zone id
        Returns:
        Firebird time zone id
        Since:
        4.0.1
      • toTimeZoneId

        public int toTimeZoneId​(int offsetMinutes)
        Return the Firebird time zone id for an offset in minutes.
        Parameters:
        offsetMinutes - Offset in minutes valid range [-1439, 1439] (or [-23:59, +23:59])
        Returns:
        Time zone id encoding the specified offset, out of range values will return id for offset 0 (UTC)