Package com.io7m.cedarbridge.runtime.api

# Class CBAbstractProtocol<T extends CBProtocolMessageType>

java.lang.Object
com.io7m.cedarbridge.runtime.api.CBAbstractProtocol<T>

Type Parameters:
  `T` - The type of messages in the protocol

All Implemented Interfaces:
  `CBProtocolType<T>`

public abstract class CBAbstractProtocol<T extends CBProtocolMessageType> extends Object implements CBProtocolType<T>
A convenient base implementation for protocols.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `CBAbstractProtocol(Class<T> inMsgClazz, String inPackageName, String inProtoName, List<CBProtocolMessageVersionedSerializerType<T>> inSerializers)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final Class<T>`
  `messageClass()`
  `final UUID`
  `protocolId()`
  `final SortedSet<CBProtocolCoordinates>`
  `protocols()`
  `final SortedSet<BigInteger>`
  `protocolVersions()`
  `final Optional<CBProtocolMessageVersionedSerializerType<T>>`
  `serializerForMessageClass(Class<T> messageClass)`
  Retrieve a serializer for the given message class.
  `final Optional<CBProtocolMessageVersionedSerializerType<T>>`
  `serializerForProtocolVersion(BigInteger version)`
  Retrieve a serializer for the given protocol version.
  `protected static <T extends CBProtocolMessageType>
  CBProtocolMessageVersionedSerializerType<T>`
  `widen(CBProtocolMessageVersionedSerializerType<? extends T> p)`

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

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

  ### Methods inherited from interface com.io7m.cedarbridge.runtime.api.CBProtocolType

  `serializerForProtocolVersion`

- ## Constructor Details

  - ### CBAbstractProtocol

    protected CBAbstractProtocol(Class<T> inMsgClazz, String inPackageName, String inProtoName, List<CBProtocolMessageVersionedSerializerType<T>> inSerializers)

- ## Method Details

  - ### widen

    protected static <T extends CBProtocolMessageType> CBProtocolMessageVersionedSerializerType<T> widen(CBProtocolMessageVersionedSerializerType<? extends T> p)

  - ### protocols

    public final SortedSet<CBProtocolCoordinates> protocols()
    Specified by:
      `protocols` in interface `CBProtocolType<T extends CBProtocolMessageType>`
    Returns:
      The set of protocol coordinates for this protocol

  - ### protocolVersions

    public final SortedSet<BigInteger> protocolVersions()
    Specified by:
      `protocolVersions` in interface `CBProtocolType<T extends CBProtocolMessageType>`
    Returns:
      The set of protocol versions for this protocol

  - ### serializerForMessageClass

    public final Optional<CBProtocolMessageVersionedSerializerType<T>> serializerForMessageClass(Class<T> messageClass)
    Description copied from interface: `CBProtocolType`
    Retrieve a serializer for the given message class.
    Specified by:
      `serializerForMessageClass` in interface `CBProtocolType<T extends CBProtocolMessageType>`
    Parameters:
      `messageClass` - The message class
    Returns:
      A serializer, if one is available

  - ### serializerForProtocolVersion

    public final Optional<CBProtocolMessageVersionedSerializerType<T>> serializerForProtocolVersion(BigInteger version)
    Description copied from interface: `CBProtocolType`
    Retrieve a serializer for the given protocol version.
    Specified by:
      `serializerForProtocolVersion` in interface `CBProtocolType<T extends CBProtocolMessageType>`
    Parameters:
      `version` - The protocol version
    Returns:
      A serializer, if one is available

  - ### messageClass

    public final Class<T> messageClass()
    Specified by:
      `messageClass` in interface `CBProtocolType<T extends CBProtocolMessageType>`
    Returns:
      The type of messages in this protocol

  - ### protocolId

    public final UUID protocolId()
    Specified by:
      `protocolId` in interface `CBProtocolType<T extends CBProtocolMessageType>`
    Returns:
      The unique protocol identifier