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 TypeMethodDescriptiondefault longcheckSupportedVersion(UUID requestedId, long requestedVersion) Check that the versionrequestedVersionfalls within the supported range of versions, and that the protocol isrequestedId.default Optional<CBProtocolSerializerFactoryType<T>>find(long version) Find the serializer with the given version.default <U extends T>
Optional<CBProtocolSerializerFactoryType<U>>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 longhighestSupportedVersion(UUID requestedId, long requestedLow, long requestedHigh) Retrieve the highest supported version of protocolrequestedIdin the range[requestedLow, requestedHigh].id()longlong
-
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
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
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
Find the serializer with the given version.- Parameters:
version- The version of protocol messages- Returns:
- The serializer, if any
-
findOrThrow
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 protocolrequestedIdin the range[requestedLow, requestedHigh].- Parameters:
requestedId- The protocol IDrequestedLow- The lowest allowed versionrequestedHigh- 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
Check that the versionrequestedVersionfalls within the supported range of versions, and that the protocol isrequestedId.- Parameters:
requestedId- The protocol IDrequestedVersion- The version- Returns:
- The version
- Throws:
IllegalArgumentException- If no version is available in the given range
-