Package com.io7m.cedarbridge.runtime.api

# Interface CBProtocolSerializerFactoryType<T extends CBProtocolMessageType>

Type Parameters:
  `T` - The type of serialized values

@ProviderType public interface CBProtocolSerializerFactoryType<T extends CBProtocolMessageType>
A serializer factory for protocols.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `CBProtocolSerializerType<T>`
  `create(CBSerializerDirectoryType directory)`
  Create a new serializer.
  `UUID`
  `id()`
  `default <U extends T>
  Optional<CBProtocolSerializerFactoryType<U>>`
  `matches(long version)`
  If this serializer factory has version `version` then return it.
  `default <U extends T>
  Optional<CBProtocolSerializerFactoryType<U>>`
  `matches(long version, Class<U> clazz)`
  If this serializer factory has version `version` and serializes messages of type `clazz`, then return it.
  `default <U extends T>
  Optional<CBProtocolSerializerFactoryType<U>>`
  `matches(Class<U> clazz)`
  If this serializer factory serializes messages of type `clazz`, then return it.
  `Class<T>`
  `serializes()`
  `long`
  `version()`

- ## Method Details

  - ### id

    UUID id()
    Returns:
      The unique ID of the protocol

  - ### version

    long version()
    Returns:
      The version of the protocol implemented by this serializer

  - ### serializes

    Class<T> serializes()
    Returns:
      The base class of serialized messages

  - ### create

    CBProtocolSerializerType<T> create(CBSerializerDirectoryType directory)
    Create a new serializer.
    Parameters:
      `directory` - The directory of available serializers
    Returns:
      A new serializer

  - ### matches

    default <U extends T> Optional<CBProtocolSerializerFactoryType<U>> matches(long version)
    If this serializer factory has version `version` then return it. Otherwise, return nothing.
    Type Parameters:
      `U` - The type of protocol messages
    Parameters:
      `version` - The protocol version
    Returns:
      This, or nothing

  - ### matches

    default <U extends T> Optional<CBProtocolSerializerFactoryType<U>> matches(long version, Class<U> clazz)
    If this serializer factory has version `version` and serializes messages of type `clazz`, then return it. Otherwise, return nothing.
    Type Parameters:
      `U` - The type of protocol messages
    Parameters:
      `version` - The protocol version
      `clazz` - The type of protocol messages
    Returns:
      This, or nothing

  - ### matches

    default <U extends T> Optional<CBProtocolSerializerFactoryType<U>> matches(Class<U> clazz)
    If this serializer factory serializes messages of type `clazz`, then return it. Otherwise, return nothing.
    Type Parameters:
      `U` - The type of protocol messages
    Parameters:
      `clazz` - The type of protocol messages
    Returns:
      This, or nothing