com.google.gwt.user.server.rpc.impl
Class StandardSerializationPolicy

java.lang.Object
  extended by com.google.gwt.user.server.rpc.SerializationPolicy
      extended by com.google.gwt.user.server.rpc.impl.StandardSerializationPolicy
All Implemented Interfaces:
TypeNameObfuscator

public class StandardSerializationPolicy
extends SerializationPolicy
implements TypeNameObfuscator

Standard implementation of a SerializationPolicy.


Field Summary
 
Fields inherited from interface com.google.gwt.user.server.rpc.impl.TypeNameObfuscator
SERVICE_INTERFACE_ID
 
Constructor Summary
StandardSerializationPolicy(java.util.Map<java.lang.Class<?>,java.lang.Boolean> serializationWhitelist, java.util.Map<java.lang.Class<?>,java.lang.Boolean> deserializationWhitelist, java.util.Map<java.lang.Class<?>,java.lang.String> obfuscatedTypeIds)
          Constructs a SerializationPolicy from several Maps.
StandardSerializationPolicy(java.util.Map<java.lang.Class<?>,java.lang.Boolean> serializationWhitelist, java.util.Map<java.lang.Class<?>,java.lang.Boolean> deserializationWhitelist, java.util.Map<java.lang.Class<?>,java.lang.String> obfuscatedTypeIds, java.util.Map<java.lang.Class<?>,java.util.Set<java.lang.String>> clientFields)
          Constructs a SerializationPolicy from several Maps.
 
Method Summary
 java.lang.String getClassNameForTypeId(java.lang.String id)
          Returns the name of the class that should be instantiated based on an obfuscated identifier.
 java.util.Set<java.lang.String> getClientFieldNamesForEnhancedClass(java.lang.Class<?> clazz)
          Returns the field names of the given class known to the client for classes that are expected to be enhanced on the server to have additional fields, or null for classes that are not expected to be enhanced.
 java.lang.String getTypeIdForClass(java.lang.Class<?> clazz)
          Returns the obfuscated identifier to be used to encode a class in the RPC wire format.
 boolean shouldDeserializeFields(java.lang.Class<?> clazz)
          Returns true if the class' fields should be deserialized.
 boolean shouldSerializeFields(java.lang.Class<?> clazz)
          Returns true if the class' fields should be serialized.
 void validateDeserialize(java.lang.Class<?> clazz)
          Validates that the specified class should be deserialized from a stream.
 void validateSerialize(java.lang.Class<?> clazz)
          Validates that the specified class should be serialized into a stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardSerializationPolicy

public StandardSerializationPolicy(java.util.Map<java.lang.Class<?>,java.lang.Boolean> serializationWhitelist,
                                   java.util.Map<java.lang.Class<?>,java.lang.Boolean> deserializationWhitelist,
                                   java.util.Map<java.lang.Class<?>,java.lang.String> obfuscatedTypeIds)
Constructs a SerializationPolicy from several Maps.


StandardSerializationPolicy

public StandardSerializationPolicy(java.util.Map<java.lang.Class<?>,java.lang.Boolean> serializationWhitelist,
                                   java.util.Map<java.lang.Class<?>,java.lang.Boolean> deserializationWhitelist,
                                   java.util.Map<java.lang.Class<?>,java.lang.String> obfuscatedTypeIds,
                                   java.util.Map<java.lang.Class<?>,java.util.Set<java.lang.String>> clientFields)
Constructs a SerializationPolicy from several Maps.

Method Detail

getClassNameForTypeId

public final java.lang.String getClassNameForTypeId(java.lang.String id)
                                             throws SerializationException
Description copied from interface: TypeNameObfuscator
Returns the name of the class that should be instantiated based on an obfuscated identifier.

Specified by:
getClassNameForTypeId in interface TypeNameObfuscator
Parameters:
id - the type id that was present in the RPC payload
Returns:
the name of the class, suitable for use by Class.forName(java.lang.String), to be instantiated
Throws:
SerializationException - if there is no class that corresponds to the obfuscated id

getClientFieldNamesForEnhancedClass

public java.util.Set<java.lang.String> getClientFieldNamesForEnhancedClass(java.lang.Class<?> clazz)
Description copied from class: SerializationPolicy
Returns the field names of the given class known to the client for classes that are expected to be enhanced on the server to have additional fields, or null for classes that are not expected to be enhanced.

Overrides:
getClientFieldNamesForEnhancedClass in class SerializationPolicy
Parameters:
clazz - the class to test
Returns:
a set containing client field names, or null

getTypeIdForClass

public final java.lang.String getTypeIdForClass(java.lang.Class<?> clazz)
                                         throws SerializationException
Description copied from interface: TypeNameObfuscator
Returns the obfuscated identifier to be used to encode a class in the RPC wire format.

Specified by:
getTypeIdForClass in interface TypeNameObfuscator
Parameters:
clazz - the class to be transmitted
Returns:
the obfuscated type identifier.
Throws:
SerializationException

shouldDeserializeFields

public boolean shouldDeserializeFields(java.lang.Class<?> clazz)
Description copied from class: SerializationPolicy
Returns true if the class' fields should be deserialized.

Specified by:
shouldDeserializeFields in class SerializationPolicy
Parameters:
clazz - the class to test
Returns:
true if the class' fields should be deserialized

shouldSerializeFields

public boolean shouldSerializeFields(java.lang.Class<?> clazz)
Description copied from class: SerializationPolicy
Returns true if the class' fields should be serialized.

Specified by:
shouldSerializeFields in class SerializationPolicy
Parameters:
clazz - the class to test
Returns:
true if the class' fields should be serialized

validateDeserialize

public void validateDeserialize(java.lang.Class<?> clazz)
                         throws SerializationException
Description copied from class: SerializationPolicy
Validates that the specified class should be deserialized from a stream.

Specified by:
validateDeserialize in class SerializationPolicy
Parameters:
clazz - the class to validate
Throws:
SerializationException - if the class is not allowed to be deserialized

validateSerialize

public void validateSerialize(java.lang.Class<?> clazz)
                       throws SerializationException
Description copied from class: SerializationPolicy
Validates that the specified class should be serialized into a stream.

Specified by:
validateSerialize in class SerializationPolicy
Parameters:
clazz - the class to validate
Throws:
SerializationException - if the class is not allowed to be serialized