Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.joda.time.tz
Class CachedDateTimeZone  view CachedDateTimeZone download CachedDateTimeZone.java

java.lang.Object
  extended byorg.joda.time.DateTimeZone
      extended byorg.joda.time.tz.CachedDateTimeZone
All Implemented Interfaces:
java.io.Serializable

public class CachedDateTimeZone
extends org.joda.time.DateTimeZone

Improves the performance of requesting time zone offsets and name keys by caching the results. Time zones that have simple rules or are fixed should not be cached, as it is unlikely to improve performance.

CachedDateTimeZone is thread-safe and immutable.

Since:
1.0

Nested Class Summary
private static class CachedDateTimeZone.Info
           
 
Nested classes inherited from class org.joda.time.DateTimeZone
 
Field Summary
private static int cInfoCacheMask
           
private  CachedDateTimeZone.Info[] iInfoCache
           
private  org.joda.time.DateTimeZone iZone
           
private static long serialVersionUID
           
 
Fields inherited from class org.joda.time.DateTimeZone
UTC
 
Constructor Summary
private CachedDateTimeZone(org.joda.time.DateTimeZone zone)
           
 
Method Summary
private  CachedDateTimeZone.Info createInfo(long millis)
           
 boolean equals(java.lang.Object obj)
          Compare this datetime zone with another.
static CachedDateTimeZone forZone(org.joda.time.DateTimeZone zone)
          Returns a new CachedDateTimeZone unless given zone is already cached.
private  CachedDateTimeZone.Info getInfo(long millis)
           
 java.lang.String getNameKey(long instant)
          Returns a non-localized name that is unique to this time zone.
 int getOffset(long instant)
          Gets the millisecond offset to add to UTC to get local time.
 int getStandardOffset(long instant)
          Gets the standard millisecond offset to add to UTC to get local time, when standard time is in effect.
 org.joda.time.DateTimeZone getUncachedZone()
          Returns the DateTimeZone being wrapped.
 int hashCode()
          Gets a hash code compatable with equals.
 boolean isFixed()
          Returns true if this time zone has no transitions.
 long nextTransition(long instant)
          Advances the given instant to where the time zone offset or name changes.
 long previousTransition(long instant)
          Retreats the given instant to where the time zone offset or name changes.
private  void readObject(java.io.ObjectInputStream in)
           
 
Methods inherited from class org.joda.time.DateTimeZone
forID, forOffsetHours, forOffsetHoursMinutes, forOffsetMillis, forTimeZone, getAvailableIDs, getDefault, getID, getMillisKeepLocal, getName, getName, getNameProvider, getOffset, getOffsetFromLocal, getProvider, getShortName, getShortName, setDefault, setNameProvider, setProvider, toString, toTimeZone, writeReplace
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

cInfoCacheMask

private static final int cInfoCacheMask

iZone

private final org.joda.time.DateTimeZone iZone

iInfoCache

private transient CachedDateTimeZone.Info[] iInfoCache
Constructor Detail

CachedDateTimeZone

private CachedDateTimeZone(org.joda.time.DateTimeZone zone)
Method Detail

forZone

public static CachedDateTimeZone forZone(org.joda.time.DateTimeZone zone)
Returns a new CachedDateTimeZone unless given zone is already cached.


readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException

getUncachedZone

public org.joda.time.DateTimeZone getUncachedZone()
Returns the DateTimeZone being wrapped.


getNameKey

public java.lang.String getNameKey(long instant)
Description copied from class: org.joda.time.DateTimeZone
Returns a non-localized name that is unique to this time zone. It can be combined with id to form a unique key for fetching localized names.


getOffset

public int getOffset(long instant)
Description copied from class: org.joda.time.DateTimeZone
Gets the millisecond offset to add to UTC to get local time.


getStandardOffset

public int getStandardOffset(long instant)
Description copied from class: org.joda.time.DateTimeZone
Gets the standard millisecond offset to add to UTC to get local time, when standard time is in effect.


isFixed

public boolean isFixed()
Description copied from class: org.joda.time.DateTimeZone
Returns true if this time zone has no transitions.


nextTransition

public long nextTransition(long instant)
Description copied from class: org.joda.time.DateTimeZone
Advances the given instant to where the time zone offset or name changes. If the instant returned is exactly the same as passed in, then no changes occur after the given instant.


previousTransition

public long previousTransition(long instant)
Description copied from class: org.joda.time.DateTimeZone
Retreats the given instant to where the time zone offset or name changes. If the instant returned is exactly the same as passed in, then no changes occur before the given instant.


hashCode

public int hashCode()
Description copied from class: org.joda.time.DateTimeZone
Gets a hash code compatable with equals.


equals

public boolean equals(java.lang.Object obj)
Description copied from class: org.joda.time.DateTimeZone
Compare this datetime zone with another.


getInfo

private CachedDateTimeZone.Info getInfo(long millis)

createInfo

private CachedDateTimeZone.Info createInfo(long millis)