ForwardingVersionedSerializer (apache-cassandra API)
Date: 2018-02-14

org.apache.cassandra.io

## Class ForwardingVersionedSerializer<T>

- java.lang.Object
- - org.apache.cassandra.io.ForwardingVersionedSerializer<T>

- All Implemented Interfaces:
    IVersionedSerializer<T>

      public abstract class ForwardingVersionedSerializer<T>
      extends java.lang.Object
      implements IVersionedSerializer<T>

  A serializer which forwards all its method calls to another serializer. Subclasses should override one or more methods to modify the behavior of the backing serializer as desired per the decorator pattern.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ForwardingVersionedSerializer()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract IVersionedSerializer<T>` | `delegate(int version)` Returns the backing delegate instance that methods are forwarded to.
    `T` | `deserialize(DataInputPlus in, int version)` Deserialize into the specified DataInputStream instance.
    `void` | `serialize(T t, DataOutputPlus out, int version)` Serialize the specified type into the specified DataOutputStream instance.
    `long` | `serializedSize(T t, int version)` Calculate serialized size of object without actually serializing.

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

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

- - ### Constructor Detail

    - #### ForwardingVersionedSerializer

          protected ForwardingVersionedSerializer()

  - ### Method Detail

    - #### delegate

          protected abstract IVersionedSerializer<T> delegate(int version)

      Returns the backing delegate instance that methods are forwarded to.
      Parameters:
        `version` - the server version
      Returns:
        the backing delegate instance that methods are forwarded to.

    - #### serialize

          public void serialize(T t,
                                DataOutputPlus out,
                                int version)
                         throws java.io.IOException

      Description copied from interface: `IVersionedSerializer`
      Serialize the specified type into the specified DataOutputStream instance.
      Specified by:
        `serialize` in interface `IVersionedSerializer<T>`
      Parameters:
        `t` - type that needs to be serialized
        `out` - DataOutput into which serialization needs to happen.
        `version` - protocol version
      Throws:
        `java.io.IOException` - if serialization fails

    - #### deserialize

          public T deserialize(DataInputPlus in,
                               int version)
                        throws java.io.IOException

      Description copied from interface: `IVersionedSerializer`
      Deserialize into the specified DataInputStream instance.
      Specified by:
        `deserialize` in interface `IVersionedSerializer<T>`
      Parameters:
        `in` - DataInput from which deserialization needs to happen.
        `version` - protocol version
      Returns:
        the type that was deserialized
      Throws:
        `java.io.IOException` - if deserialization fails

    - #### serializedSize

          public long serializedSize(T t,
                                     int version)

      Description copied from interface: `IVersionedSerializer`
      Calculate serialized size of object without actually serializing.
      Specified by:
        `serializedSize` in interface `IVersionedSerializer<T>`
      Parameters:
        `t` - object to calculate serialized size
        `version` - protocol version
      Returns:
        serialized size of object t

Copyright © 2018 The Apache Software Foundation