2 *******************************************************************************
3 * Copyright (C) 2008, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 *******************************************************************************
7 package com.ibm.icu.impl.jdkadapter;
10 import java.util.Locale;
12 import com.ibm.icu.impl.icuadapter.TimeZoneJDK;
13 import com.ibm.icu.util.TimeZone;
16 * TimeZoneICU is an adapter class which wraps ICU4J TimeZone and
17 * implements java.util.TimeZone APIs.
19 public class TimeZoneICU extends java.util.TimeZone {
21 private static final long serialVersionUID = 6019030618408620277L;
23 private TimeZone fIcuTz;
25 private TimeZoneICU(TimeZone icuTz) {
29 public static java.util.TimeZone wrap(TimeZone icuTz) {
30 if (icuTz instanceof TimeZoneJDK) {
31 return ((TimeZoneJDK)icuTz).unwrap();
33 return new TimeZoneICU(icuTz);
36 public TimeZone unwrap() {
41 public Object clone() {
42 TimeZoneICU other = (TimeZoneICU)super.clone();
43 other.fIcuTz = (TimeZone)fIcuTz.clone();
47 //public String getDisplayName()
48 //public String getDisplayName(boolean daylight, int style)
49 //public String getDisplayName(Locale locale)
52 public String getDisplayName(boolean daylight, int style, Locale locale) {
53 return fIcuTz.getDisplayName(daylight, style, locale);
57 public int getDSTSavings() {
58 return fIcuTz.getDSTSavings();
62 public String getID() {
63 return fIcuTz.getID();
67 public int getOffset(int era, int year, int month, int day, int dayOfWeek, int milliseconds) {
68 return fIcuTz.getOffset(era, year, month, day, dayOfWeek, milliseconds);
72 public int getOffset(long date) {
73 return fIcuTz.getOffset(date);
77 public int getRawOffset() {
78 return fIcuTz.getRawOffset();
82 public boolean hasSameRules(java.util.TimeZone other) {
83 return other.hasSameRules(TimeZoneICU.wrap(fIcuTz));
87 public boolean inDaylightTime(Date date) {
88 return fIcuTz.inDaylightTime(date);
92 public void setID(String ID) {
97 public void setRawOffset(int offsetMillis) {
98 fIcuTz.setRawOffset(offsetMillis);
102 public boolean useDaylightTime() {
103 return fIcuTz.useDaylightTime();