Package com.google.gwt.user.client.rpc
Class CustomFieldSerializer<T>
java.lang.Object
com.google.gwt.user.client.rpc.CustomFieldSerializer<T>
- Type Parameters:
T
- the type of the object being serialized
- Direct Known Subclasses:
ServerCustomFieldSerializer
An interface that may be implemented by class-based custom field serializers
which will reduce the amount of server-side reflection during serialization,
hence improving their serialization performance.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
deserializeInstance
(SerializationStreamReader streamReader, T instance) Deserializes the content of the object from theSerializationStreamReader
.boolean
instantiateInstance
(SerializationStreamReader streamReader) Instantiates an object from theSerializationStreamReader
.abstract void
serializeInstance
(SerializationStreamWriter streamWriter, T instance) Serializes the content of the object into theSerializationStreamWriter
.
-
Constructor Details
-
CustomFieldSerializer
public CustomFieldSerializer()
-
-
Method Details
-
deserializeInstance
public abstract void deserializeInstance(SerializationStreamReader streamReader, T instance) throws SerializationException Deserializes the content of the object from theSerializationStreamReader
.- Parameters:
streamReader
- theSerializationStreamReader
to read the object's content frominstance
- the object instance to deserialize- Throws:
SerializationException
- if the deserialization operation is not successful
-
hasCustomInstantiateInstance
public boolean hasCustomInstantiateInstance()- Returns:
true
if a specialistinstantiateInstance(com.google.gwt.user.client.rpc.SerializationStreamReader)
is implemented;false
otherwise
-
instantiateInstance
Instantiates an object from theSerializationStreamReader
.Most of the time, this can be left unimplemented and the framework will instantiate the instance itself. This is typically used when the object being deserialized is immutable, hence it has to be created with its state already set.
If this is overridden, the
hasCustomInstantiateInstance()
method must returntrue
in order for the framework to know to call it.- Parameters:
streamReader
- theSerializationStreamReader
to read the object's content from- Returns:
- an object that has been loaded from the
SerializationStreamReader
- Throws:
SerializationException
- if the instantiation operation is not successful
-
serializeInstance
public abstract void serializeInstance(SerializationStreamWriter streamWriter, T instance) throws SerializationException Serializes the content of the object into theSerializationStreamWriter
.- Parameters:
streamWriter
- theSerializationStreamWriter
to write the object's content toinstance
- the object instance to serialize- Throws:
SerializationException
- if the serialization operation is not successful
-