Class TimeZoneAdapter

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public class TimeZoneAdapter
    extends java.util.TimeZone
    TimeZoneAdapter wraps a com.ibm.icu.util.TimeZone subclass and inherits from java.util.TimeZone. Without this class, we would need to 'port' java.util.Date to com.ibm.icu.util as well, so that Date could interoperate properly with the com.ibm.icu.util TimeZone and Calendar classes. With this class, we can use java.util.Date together with com.ibm.icu.util classes.
    Since:
    ICU 2.8
    See Also:
    TimeZone.setDefault(com.ibm.icu.util.TimeZone), Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static long serialVersionUID  
      private TimeZone zone
      The contained com.ibm.icu.util.TimeZone object.
      • Fields inherited from class java.util.TimeZone

        LONG, SHORT
    • Constructor Summary

      Constructors 
      Constructor Description
      TimeZoneAdapter​(TimeZone zone)
      Constructs an adapter for a com.ibm.icu.util.TimeZone object.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone()
      Boilerplate API; calls through to wrapped object.
      boolean equals​(java.lang.Object obj)
      Boilerplate API; calls through to wrapped object.
      int getOffset​(int era, int year, int month, int day, int dayOfWeek, int millis)
      TimeZone API; calls through to wrapped time zone.
      int getRawOffset()
      TimeZone API; calls through to wrapped time zone.
      int hashCode()
      Boilerplate API; calls through to wrapped object.
      boolean hasSameRules​(java.util.TimeZone other)
      TimeZone API; calls through to wrapped time zone.
      boolean inDaylightTime​(java.util.Date date)
      TimeZone API; calls through to wrapped time zone.
      void setID​(java.lang.String ID)
      TimeZone API; calls through to wrapped time zone.
      void setRawOffset​(int offsetMillis)
      TimeZone API; calls through to wrapped time zone.
      java.lang.String toString()
      Returns a string representation of this object.
      TimeZone unwrap()
      Return the java.util.TimeZone wrapped by this object.
      boolean useDaylightTime()
      TimeZone API; calls through to wrapped time zone.
      static java.util.TimeZone wrap​(TimeZone tz)
      Given a java.util.TimeZone, wrap it in the appropriate adapter subclass of com.ibm.icu.util.TimeZone and return the adapter.
      • Methods inherited from class java.util.TimeZone

        getAvailableIDs, getAvailableIDs, getDefault, getDisplayName, getDisplayName, getDisplayName, getDisplayName, getDSTSavings, getID, getOffset, getTimeZone, getTimeZone, observesDaylightTime, setDefault, toZoneId
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • zone

        private TimeZone zone
        The contained com.ibm.icu.util.TimeZone object. Must not be null. We delegate all methods to this object.
    • Constructor Detail

      • TimeZoneAdapter

        public TimeZoneAdapter​(TimeZone zone)
        Constructs an adapter for a com.ibm.icu.util.TimeZone object.
    • Method Detail

      • wrap

        public static java.util.TimeZone wrap​(TimeZone tz)
        Given a java.util.TimeZone, wrap it in the appropriate adapter subclass of com.ibm.icu.util.TimeZone and return the adapter.
      • unwrap

        public TimeZone unwrap()
        Return the java.util.TimeZone wrapped by this object.
      • setID

        public void setID​(java.lang.String ID)
        TimeZone API; calls through to wrapped time zone.
        Overrides:
        setID in class java.util.TimeZone
      • hasSameRules

        public boolean hasSameRules​(java.util.TimeZone other)
        TimeZone API; calls through to wrapped time zone.
        Overrides:
        hasSameRules in class java.util.TimeZone
      • getOffset

        public int getOffset​(int era,
                             int year,
                             int month,
                             int day,
                             int dayOfWeek,
                             int millis)
        TimeZone API; calls through to wrapped time zone.
        Specified by:
        getOffset in class java.util.TimeZone
      • getRawOffset

        public int getRawOffset()
        TimeZone API; calls through to wrapped time zone.
        Specified by:
        getRawOffset in class java.util.TimeZone
      • setRawOffset

        public void setRawOffset​(int offsetMillis)
        TimeZone API; calls through to wrapped time zone.
        Specified by:
        setRawOffset in class java.util.TimeZone
      • useDaylightTime

        public boolean useDaylightTime()
        TimeZone API; calls through to wrapped time zone.
        Specified by:
        useDaylightTime in class java.util.TimeZone
      • inDaylightTime

        public boolean inDaylightTime​(java.util.Date date)
        TimeZone API; calls through to wrapped time zone.
        Specified by:
        inDaylightTime in class java.util.TimeZone
      • clone

        public java.lang.Object clone()
        Boilerplate API; calls through to wrapped object.
        Overrides:
        clone in class java.util.TimeZone
      • hashCode

        public int hashCode()
        Boilerplate API; calls through to wrapped object.
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Boilerplate API; calls through to wrapped object.
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Returns a string representation of this object.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of this object.