com.atlassian.confluence.core
Class TimeZone

java.lang.Object
  extended by com.atlassian.confluence.core.TimeZone

public class TimeZone
extends Object

Represents an instance of an valid time zone, wrapping a TimeZone. Call getInstance(String) or getDefault() 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.


Method Summary
 boolean equals(Object o)
           
static TimeZone getDefault()
           
 String getDisplayOffset()
           
 String getID()
           
static TimeZone getInstance(String timeZoneID)
          Returns the flyweight TimeZone for the given ID, which is the same instance used for this time zone throughout the system.
 String getMessageKey()
           
static List<TimeZone> getSortedTimeZones()
           
 TimeZone getWrappedTimeZone()
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static TimeZone getInstance(String timeZoneID)
Returns the flyweight TimeZone 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 by TimeZone
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 by getSortedTimeZones().

getID

public String getID()
Returns:
the time zone identifier as returned by TimeZone.getID().

getMessageKey

public String getMessageKey()
Returns:
a message key which can be used with ConfluenceActionSupport.getText(String) to display the localised name of the time zone.

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

getDisplayOffset

public String getDisplayOffset()
Returns:
the raw offset in a printable format, e.g. +0800, -1230

getDefault

public static TimeZone getDefault()
Returns:
the server's default timezone, retrieved from TimeZone.getDefault().

getSortedTimeZones

public static List<TimeZone> 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

public TimeZone getWrappedTimeZone()
Returns:
the underlying TimeZone which is wrapped by this implementation.


Copyright © 2003-2012 Atlassian. All Rights Reserved.