Package net.time4j.tz

Interface ZoneModelProvider


public interface ZoneModelProvider

SPI interface which encapsulates the timezone repository and provides all necessary data and transitions for a given timezone id.

Implementations are usually stateless and should normally not try to manage a cache. Instead Time4J uses its own cache. The fact that this interface is used per java.util.ServiceLoader requires a concrete implementation to offer a public no-arg constructor.

Since:
3.20/4.16
Author:
Meno Hochschild
See Also:
ServiceLoader
  • Method Details

    • getAvailableIDs

      Set<String> getAvailableIDs()

      Gets all available and supported timezone identifiers.

      Returns:
      unmodifiable set of timezone ids
      See Also:
      TimeZone.getAvailableIDs()
    • getAliases

      Map<String,​String> getAliases()

      Gets an alias table whose keys represent alternative identifiers mapped to other aliases or finally canonical timezone IDs..

      Example: "PST" => "America/Los_Angeles".

      Returns:
      map from all timezone aliases to canoncial ids
    • load

      TransitionHistory load(String zoneID)

      Loads an offset transition history for given timezone id.

      The argument never contains the provider name as prefix. It is instead the part after the "~"-char (if not absent).

      Parameters:
      zoneID - timezone id (i.e. "Europe/London")
      Returns:
      timezone history or null if there are no data
      Throws:
      IllegalArgumentException - if given id is wrong
      IllegalStateException - if timezone database is broken
      See Also:
      getAvailableIDs(), getAliases(), TimeZone.getTimeZone(String)
    • getFallback

      String getFallback()

      Determines if in case of a failed search another ZoneModelProvider should be called as alternative with possibly different rules.

      The special name "DEFAULT" can be used to denote the default zone provider. Note that the fallback provider will only affect the rules but not the id or display names of a new timezone.

      Returns:
      name of alternative provider or empty if no fallback happens
      See Also:
      load(String)
    • getName

      String getName()

      Gets the name of the underlying repository.

      The Olson/IANA-repository (and any provider which makes use of these data (direct or indirect)) has the name "TZDB". The names "java.util.TimeZone" and "DEFAULT" are reserved and cannot be used.

      Returns:
      String
    • getLocation

      String getLocation()

      Describes the location or source of the repository.

      Returns:
      String which refers to an URI or empty if unknown
    • getVersion

      String getVersion()

      Queries the version of the underlying repository.

      In most cases the version has the Olson format starting with a four-digit year number followed by a small letter in range a-z.

      Returns:
      String (for example "2011n") or empty if unknown
    • getSpecificZoneNameRepository

      default ZoneNameProvider getSpecificZoneNameRepository()

      Queries if specific zone names are to be used.

      Returns:
      specific name repository or null if not relevant