Package com.google.gwt.user.server.rpc
Class SerializationPolicy
java.lang.Object
com.google.gwt.user.server.rpc.SerializationPolicy
This is an abstract class for representing the serialization policy for a
given module and
RemoteService.
The serialize and deserialize queries are from the perspective
of the server, not the web browser.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetClientFieldNamesForEnhancedClass(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.booleanReturns true if there may be any unsafe client fields in the serialization policy.abstract booleanshouldDeserializeFields(Class<?> clazz) Returnstrueif the class' fields should be deserialized.abstract booleanshouldSerializeFields(Class<?> clazz) Returnstrueif the class' fields should be serialized.booleanReturns whether the client was compiled withrpc.XserializeFinalFields = true.abstract voidvalidateDeserialize(Class<?> clazz) Validates that the specified class should be deserialized from a stream.abstract voidvalidateSerialize(Class<?> clazz) Validates that the specified class should be serialized into a stream.
-
Constructor Details
-
SerializationPolicy
public SerializationPolicy()
-
-
Method Details
-
getClientFieldNamesForEnhancedClass
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.- Parameters:
clazz- the class to test- Returns:
- a set containing client field names, or null
-
shouldDeserializeFields
Returnstrueif the class' fields should be deserialized.- Parameters:
clazz- the class to test- Returns:
trueif the class' fields should be deserialized
-
shouldSerializeFields
Returnstrueif the class' fields should be serialized.- Parameters:
clazz- the class to test- Returns:
trueif the class' fields should be serialized
-
shouldSerializeFinalFields
public boolean shouldSerializeFinalFields()Returns whether the client was compiled withrpc.XserializeFinalFields = true. -
validateDeserialize
Validates that the specified class should be deserialized from a stream.- Parameters:
clazz- the class to validate- Throws:
SerializationException- if the class is not allowed to be deserialized
-
validateSerialize
Validates that the specified class should be serialized into a stream.- Parameters:
clazz- the class to validate- Throws:
SerializationException- if the class is not allowed to be serialized
-
hasClientFields
public boolean hasClientFields()Returns true if there may be any unsafe client fields in the serialization policy. The default implementation returns true to ensure that custom implementations validate accordingly.- Returns:
- true if the client may send unsafely serialized data, false otherwise
-