com.extjs.gxt.ui.client.data
Class RpcMap

java.lang.Object
  extended by com.extjs.gxt.ui.client.data.RpcMap
All Implemented Interfaces:
java.io.Serializable

public class RpcMap
extends java.lang.Object
implements java.io.Serializable

RpcMap is used to workaround a part of GWT RPC system.

The GWT RPC rebinder generates field serializers for every type that is assignable to any type in the RPC interfaces.

If BaseModel was to use "Map<String, Serializable> map" this would trigger the RPC system to generate field serializers for EVERY Serializable type in your GWT Module's class path.

Therefore BaseModel uses "Map<String, RpcField> map" and relies on type erasure (cast to Map<Object,Object>) to work around this.

The only drawback is that if you have to ensure that field serializers are generated for any type you add to this map.

RpcMap ensures that the following types are supported Byte, Short, Integer, Long, Float, Double, Date, Boolean, and arrays of these types. As well as List, Set and Map

See Also:
Serialized Form

Constructor Summary
RpcMap()
           
 
Method Summary
 void clear()
          Removes all the mappings from this map.
 boolean containsKey(java.lang.String key)
          Returns true if this map contains a mapping for this key.
 boolean containsValue(java.lang.Object value)
          Returns true if this map maps one or more keys to the specified value.
 java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
          Returns a Set view of the mappings contained in this map.
 boolean equals(java.lang.Object o)
           
 java.lang.Object get(java.lang.String key)
          Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
 java.util.Map<java.lang.String,java.lang.Object> getTransientMap()
          Returns the internal map.
 int hashCode()
           
 boolean isEmpty()
          Returns true if this map contains no key-value mappings.
 java.util.Set<java.lang.String> keySet()
          Returns a Set view of the keys contained in this map.
 java.lang.Object put(java.lang.String key, java.lang.Object value)
          Associates the specified value with the specified key in this map (optional operation).
 void putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> m)
          Copies all of the mappings from the specified map to this map (optional operation).
 java.lang.Object remove(java.lang.Object key)
          Removes the mapping for a key from this map if it is present (optional operation).
 int size()
          Returns the number of key-value mappings in this map.
 java.lang.String toString()
           
 java.util.Collection<java.lang.Object> values()
          Returns a Collection view of the values contained in this map.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RpcMap

public RpcMap()
Method Detail

getTransientMap

public java.util.Map<java.lang.String,java.lang.Object> getTransientMap()
Returns the internal map.

Returns:
the map

clear

public void clear()
Removes all the mappings from this map.


containsKey

public boolean containsKey(java.lang.String key)
Returns true if this map contains a mapping for this key.

Parameters:
key - the key
Returns:
true if mapping exists

containsValue

public boolean containsValue(java.lang.Object value)
Returns true if this map maps one or more keys to the specified value.

Parameters:
value - the value
Returns:
true if this map maps one or more keys to the specified value

entrySet

public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
Returns a Set view of the mappings contained in this map.

Returns:
a set view of the mappings

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

get

public java.lang.Object get(java.lang.String key)
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

Parameters:
key - the key
Returns:
the value to which the specified key is mapped, or null if this map contains no mapping for the key

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

isEmpty

public boolean isEmpty()
Returns true if this map contains no key-value mappings.

Returns:
true if this map contains no key-value mappings

keySet

public java.util.Set<java.lang.String> keySet()
Returns a Set view of the keys contained in this map.

Returns:
a set view of the keys contained in this map

put

public java.lang.Object put(java.lang.String key,
                            java.lang.Object value)
Associates the specified value with the specified key in this map (optional operation).

Parameters:
key - key with which the specified value is to be associated
value - value to be associated with the specified key
Returns:
the previous value associated with key, or null if there was no mapping for key

putAll

public void putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> m)
Copies all of the mappings from the specified map to this map (optional operation).

Parameters:
m - mappings to be stored in this map

remove

public java.lang.Object remove(java.lang.Object key)
Removes the mapping for a key from this map if it is present (optional operation).

Parameters:
key - key whose mapping is to be removed from the map
Returns:
the previous value associated with key, or null if there was no mapping for key

size

public int size()
Returns the number of key-value mappings in this map.

Returns:
the number of key-value mappings in this map

values

public java.util.Collection<java.lang.Object> values()
Returns a Collection view of the values contained in this map.

Returns:
a collection view of the values contained in this map

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object