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
ConstructorsModifierConstructorDescriptionprotectedCBAbstractProtocol(Class<T> inMsgClazz, String inPackageName, String inProtoName, List<CBProtocolMessageVersionedSerializerType<T>> inSerializers) -
Method Summary
Modifier and TypeMethodDescriptionfinal UUIDfinal SortedSet<CBProtocolCoordinates> final SortedSet<BigInteger> serializerForMessageClass(Class<T> messageClass) Retrieve a serializer for the given message class.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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CBProtocolType
serializerForProtocolVersion
-
Constructor Details
-
CBAbstractProtocol
-
-
Method Details
-
widen
protected static <T extends CBProtocolMessageType> CBProtocolMessageVersionedSerializerType<T> widen(CBProtocolMessageVersionedSerializerType<? extends T> p) -
protocols
- Specified by:
protocolsin interfaceCBProtocolType<T extends CBProtocolMessageType>- Returns:
- The set of protocol coordinates for this protocol
-
protocolVersions
- Specified by:
protocolVersionsin interfaceCBProtocolType<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:CBProtocolTypeRetrieve a serializer for the given message class.- Specified by:
serializerForMessageClassin interfaceCBProtocolType<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:CBProtocolTypeRetrieve a serializer for the given protocol version.- Specified by:
serializerForProtocolVersionin interfaceCBProtocolType<T extends CBProtocolMessageType>- Parameters:
version- The protocol version- Returns:
- A serializer, if one is available
-
messageClass
- Specified by:
messageClassin interfaceCBProtocolType<T extends CBProtocolMessageType>- Returns:
- The type of messages in this protocol
-
protocolId
- Specified by:
protocolIdin interfaceCBProtocolType<T extends CBProtocolMessageType>- Returns:
- The unique protocol identifier
-