Package com.atlassian.confluence.core
Class TimeZone
java.lang.Object
com.atlassian.confluence.core.TimeZone
Represents an instance of an valid time zone, wrapping a
TimeZone
.
Call getInstance(String)
to get a specific TimeZone object.
The list of acceptable time zones is loaded once from a properties file, and trying to retrieve a time zone not in this list will return the application's default time zone.
TODO CONFDEV-27850: should be using a CacheLoader for timeZonesByID to avoid race conditions on TimeZone construction.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
static TimeZone
Deprecated.since 5.7.getID()
static TimeZone
getInstance
(String timeZoneID) Returns the flyweightTimeZone
for the given ID, which is the same instance used for this time zone throughout the system.static TimeZone
getInstance
(TimeZone timeZone) int
hashCode()
toString()
-
Method Details
-
getInstance
Returns the flyweightTimeZone
for the given ID, which is the same instance used for this time zone throughout the system.- Parameters:
timeZoneID
- a valid time zone ID as specified byTimeZone
- Returns:
- the
TimeZone
specified by the time zone ID, or the default time zone if timeZoneID is null or not in the list of time zones returned bygetSortedTimeZones()
.
-
getInstance
-
getID
- Returns:
- the time zone identifier as returned by
TimeZone.getID()
.
-
getMessageKey
- Returns:
- a message key which can be used with
AbstractI18nActionSupport.getText(String)
to display the localised name of the time zone.
-
toString
-
hashCode
public int hashCode() -
equals
-
getDisplayOffset
- Returns:
- the raw offset in a printable format, e.g. +0800, -1230
-
getDefault
Deprecated.since 5.7. UseTimeZoneManager.getDefaultTimeZone()
} instead.This method should no longer be used. The notion of a "default timezone" is now specific to the current tenant, rather than a system level JDK concern.- Returns:
- the tenant's default timezone, retrieved from
TimeZoneManager.getDefaultTimeZone()
} - See Also:
-
TimeZoneManager.getDefaultTimeZone()
-
getSortedTimeZones
- Returns:
- the list of available time zones sorted by offset from GMT (west to east), then by alphabetical order of time zone ID.
-
getWrappedTimeZone
- Returns:
- the underlying
TimeZone
which is wrapped by this implementation.
-