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

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

public class LegacySerializationPolicy
extends SerializationPolicy
implements TypeNameObfuscator

A serialization policy compatible with GWT 1.3.3 RPC. This is used when no serialization policy file is present.

The set of allowed types are:

  1. Primitives
  2. Types assignable to IsSerializable
  3. Types with custom field serializers
  4. Arrays of the above types

Types that derive from Serializable but do not meet any of the above criteria may not be serialized as leaf types. However, their fields may be serialized as super types of a legal type.


Field Summary
 
Fields inherited from interface com.google.gwt.user.server.rpc.impl.TypeNameObfuscator
SERVICE_INTERFACE_ID
 
Method Summary
 java.lang.String getClassNameForTypeId(java.lang.String id)
          Implemented to fail with a useful error message.
static LegacySerializationPolicy getInstance()
           
 java.lang.String getTypeIdForClass(java.lang.Class<?> clazz)
          Implemented to fail with a useful error message.
 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 com.google.gwt.user.server.rpc.SerializationPolicy
getClientFieldNamesForEnhancedClass
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static LegacySerializationPolicy getInstance()

getClassNameForTypeId

public final java.lang.String getClassNameForTypeId(java.lang.String id)
                                             throws SerializationException
Implemented to fail with a useful error message.

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

getTypeIdForClass

public final java.lang.String getTypeIdForClass(java.lang.Class<?> clazz)
                                         throws SerializationException
Implemented to fail with a useful error message.

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