Package com.io7m.cedarbridge.runtime.api

# Interface CBProtocolSerializerCollectionType<T extends CBProtocolMessageType>

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

All Known Implementing Classes:
  `CBProtocolSerializerCollection`

public interface CBProtocolSerializerCollectionType<T extends CBProtocolMessageType>
A collection of protocol serializers.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default long`
  `checkSupportedVersion(UUID requestedId, long requestedVersion)`
  Check that the version `requestedVersion` falls within the supported range of versions, and that the protocol is `requestedId`.
  `List<CBProtocolSerializerFactoryType<T>>`
  `factories()`
  `default Optional<CBProtocolSerializerFactoryType<T>>`
  `find(long version)`
  Find the serializer with the given version.
  `default <U extends T>
  Optional<CBProtocolSerializerFactoryType<U>>`
  `find(Class<U> clazz)`
  Find the serializer with the given type.
  `default CBProtocolSerializerFactoryType<T>`
  `findOrThrow(long version)`
  Find the serializer with the given type.
  `default <U extends T>
  CBProtocolSerializerFactoryType<U>`
  `findOrThrow(Class<U> clazz)`
  Find the serializer with the given type.
  `default long`
  `highestSupportedVersion(UUID requestedId, long requestedLow, long requestedHigh)`
  Retrieve the highest supported version of protocol `requestedId` in the range `[requestedLow, requestedHigh]`.
  `UUID`
  `id()`
  `long`
  `versionLower()`
  `long`
  `versionUpper()`

- ## Method Details

  - ### id

    UUID id()
    Returns:
      The protocol ID

  - ### versionLower

    long versionLower()
    Returns:
      The lowest supported protocol version

  - ### versionUpper

    long versionUpper()
    Returns:
      The highest supported protocol version

  - ### factories

    List<CBProtocolSerializerFactoryType<T>> factories()
    Returns:
      The list of protocol serializers

  - ### find

    default <U extends T> Optional<CBProtocolSerializerFactoryType<U>> find(Class<U> clazz)
    Find the serializer with the given type.
    Type Parameters:
      `U` - The type of protocol messages
    Parameters:
      `clazz` - The type of protocol messages
    Returns:
      The serializer, if any

  - ### findOrThrow

    default <U extends T> CBProtocolSerializerFactoryType<U> findOrThrow(Class<U> clazz)
    Find the serializer with the given type.
    Type Parameters:
      `U` - The type of protocol messages
    Parameters:
      `clazz` - The type of protocol messages
    Returns:
      The serializer, if any

  - ### find

    default Optional<CBProtocolSerializerFactoryType<T>> find(long version)
    Find the serializer with the given version.
    Parameters:
      `version` - The version of protocol messages
    Returns:
      The serializer, if any

  - ### findOrThrow

    default CBProtocolSerializerFactoryType<T> findOrThrow(long version)
    Find the serializer with the given type.
    Parameters:
      `version` - The type of protocol messages
    Returns:
      The serializer, if any

  - ### highestSupportedVersion

    default long highestSupportedVersion(UUID requestedId, long requestedLow, long requestedHigh) throws IllegalArgumentException
    Retrieve the highest supported version of protocol `requestedId` in the range `[requestedLow, requestedHigh]`.
    Parameters:
      `requestedId` - The protocol ID
      `requestedLow` - The lowest allowed version
      `requestedHigh` - The highest allowed version
    Returns:
      The version
    Throws:
      `IllegalArgumentException` - If the range is malformed, or if no version is available in the given range

  - ### checkSupportedVersion

    default long checkSupportedVersion(UUID requestedId, long requestedVersion)
    Check that the version `requestedVersion` falls within the supported range of versions, and that the protocol is `requestedId`.
    Parameters:
      `requestedId` - The protocol ID
      `requestedVersion` - The version
    Returns:
      The version
    Throws:
      `IllegalArgumentException` - If no version is available in the given range