com.google.gwt.maps.client.geocode
Class GeocodeCache

java.lang.Object
  extended by com.google.gwt.maps.client.geocode.GeocodeCache
Direct Known Subclasses:
CustomGeocodeCache, FactualGeocodeCache

public abstract class GeocodeCache
extends java.lang.Object

A base class used to represent a client side cache for Geocoder requests. This class is a base class but is not intended to be extended directly. For a functional class that you can also extend, see CustomGeocodeCache.


Field Summary
protected  com.google.gwt.core.client.JavaScriptObject jsoPeer
           
 
Constructor Summary
protected GeocodeCache()
          Deprecated. use GeocodeCache(JavaScriptObject) instead
protected GeocodeCache(com.google.gwt.core.client.JavaScriptObject jsoPeer)
          Instantiate a new wrapper object from an existing JavaScript instance.
 
Method Summary
abstract  com.google.gwt.core.client.JavaScriptObject get(java.lang.String address)
          Returns the reply which was stored under the given address.
abstract  boolean isCacheable(com.google.gwt.core.client.JavaScriptObject reply)
          Returns whether or not the given reply should be cached.
abstract  void put(java.lang.String address, com.google.gwt.core.client.JavaScriptObject reply)
          Stores the given reply under the given address.
abstract  void reset()
          Purges all replies from the cache.
abstract  java.lang.String toCanonical(java.lang.String address)
          Returns what is considered a canonical version of the address.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jsoPeer

protected final com.google.gwt.core.client.JavaScriptObject jsoPeer
Constructor Detail

GeocodeCache

@Deprecated
protected GeocodeCache()
Deprecated. use GeocodeCache(JavaScriptObject) instead


GeocodeCache

protected GeocodeCache(com.google.gwt.core.client.JavaScriptObject jsoPeer)
Instantiate a new wrapper object from an existing JavaScript instance.

Method Detail

get

public abstract com.google.gwt.core.client.JavaScriptObject get(java.lang.String address)
Returns the reply which was stored under the given address. If no reply was ever stored for the given address, this method returns null

Parameters:
address - the address used as a key to lookup.
Returns:
the previously cached result.

isCacheable

public abstract boolean isCacheable(com.google.gwt.core.client.JavaScriptObject reply)
Returns whether or not the given reply should be cached. By default very rudimentary checks are performed on the reply object. In particular, this class makes sure that the object is not null and that it has the name field . This method may be overridden by extending classes to provide more precise conditions on the reply object.

Parameters:
reply - the reply to test.
Returns:
true if the value can be cached.

put

public abstract void put(java.lang.String address,
                         com.google.gwt.core.client.JavaScriptObject reply)
Stores the given reply under the given address. This method calls the isCacheable(com.google.gwt.core.client.JavaScriptObject) method to verify that the reply may be cached. If it gets a go-ahead, it caches the reply under the address normalized with the help of the toCanonical(java.lang.String) method.

Parameters:
address - the address used in the query.
reply - the reply value to cache.

reset

public abstract void reset()
Purges all replies from the cache. After this method returns, the cache is empty.


toCanonical

public abstract java.lang.String toCanonical(java.lang.String address)
Returns what is considered a canonical version of the address. It converts the address parameter to lower case, replaces commas with spaces and replaces multiple spaces with one space.

Parameters:
address - the address to convert to canonical form.
Returns:
the address in canonical form.