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`

      public abstract class CustomFieldSerializer<T>
      extends java.lang.Object

  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

    Constructors
    Constructor | Description
    --- | ---
    `CustomFieldSerializer()` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `abstract void` | `deserializeInstance​(SerializationStreamReader streamReader, T instance)` | Deserializes the content of the object from the `SerializationStreamReader`.
    `boolean` | `hasCustomInstantiateInstance()` |
    `T` | `instantiateInstance​(SerializationStreamReader streamReader)` | Instantiates an object from the `SerializationStreamReader`.
    `abstract void` | `serializeInstance​(SerializationStreamWriter streamWriter, T instance)` | Serializes the content of the object into the `SerializationStreamWriter`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CustomFieldSerializer

          public CustomFieldSerializer()

  - ### Method Detail

    - #### deserializeInstance

          public abstract void deserializeInstance​(SerializationStreamReader streamReader,
                                                   T instance)
                                            throws SerializationException

      Deserializes the content of the object from the `SerializationStreamReader`.
      Parameters:
        `streamReader` - the `SerializationStreamReader` to read the object's content from
        `instance` - the object instance to deserialize
      Throws:
        `SerializationException` - if the deserialization operation is not successful

    - #### hasCustomInstantiateInstance

          public boolean hasCustomInstantiateInstance()

      Returns:
        `true` if a specialist `instantiateInstance(com.google.gwt.user.client.rpc.SerializationStreamReader)` is implemented; `false` otherwise

    - #### instantiateInstance

          public T instantiateInstance​(SerializationStreamReader streamReader)
                                throws SerializationException

      Instantiates an object from the `SerializationStreamReader`.

      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 return `true` in order for the framework to know to call it.

      Parameters:
        `streamReader` - the `SerializationStreamReader` 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 the `SerializationStreamWriter`.
      Parameters:
        `streamWriter` - the `SerializationStreamWriter` to write the object's content to
        `instance` - the object instance to serialize
      Throws:
        `SerializationException` - if the serialization operation is not successful