public class TimeZoneMapper extends Object
Constructor and Description |
---|
TimeZoneMapper(String timeZoneListXML)
Initializes a newly created
TimeZoneMapper object with
the native time zones from the specified XML-formatted time zone
list. |
Modifier and Type | Method and Description |
---|---|
void |
addTimeZone(String key,
int offset)
Adds a time zone mapping with the specified key and raw offset in
milliseconds to the mapper.
|
String |
getKey(TimeZone tz)
Returns a TerraExplorer time zone key for the specified
TimeZone object. |
TimeZone |
getTimeZone(String key)
Returns a
TimeZone object for the specified
TerraExplorer time zone key. |
public TimeZoneMapper(String timeZoneListXML)
TimeZoneMapper
object with
the native time zones from the specified XML-formatted time zone
list.timeZoneListXML
- an XML-formatted list of native time zonespublic void addTimeZone(String key, int offset)
key
- the TerraExplorer time zone key for the new mapping to addoffset
- the raw offset in millisecondspublic String getKey(TimeZone tz)
TimeZone
object.
This method uses the raw offset to UTC time obtained from the
specified time zone's getRawOffset
method to get a
TerraExplorer time zone key from keys
.
tz
- the TimeZone
object to get a TerraExplorer
time zone key forTimeZone
object or null
, if no key
was found for the specified time zonepublic TimeZone getTimeZone(String key)
TimeZone
object for the specified
TerraExplorer time zone key.
This method returns the time zone with the first id returned by
TimeZone.getAvailableIDs(offset)
for the offset mapped
against the specified key. So, basically this method returns
any time zone with proper raw offset. Only if the raw offset
equals the raw offset of the current default time zone, this current
default time zone is returned. If no offset was found for the
specified key, null
is returned.
key
- the TerraExplorer time zone key to get a
TimeZone
object forTimeZone
object for the specified
TerraExplorer time zone key or null
, if no time
zone was found for the specified keyCopyright © 2009 - 2016 DataGis. All Rights Reserved.