Class RootContext
java.lang.Object
crow.game.examples.pingpong.proto.RootContext
- All Implemented Interfaces:
Context
The root context is the context implementation for the Ping/Pong server and defines the packet
version and provides the
PacketHandlers.
More complicated client/server implementations could use spring or guice or SPI to lookup
packet POJOs and PacketHandlers but this one is too simple to justify that level of work.
Ideally we will have a common server or client module that implements a Context that does use guice or spring and then that module is just marked as "requiring injection library".
-
Nested Class Summary
Nested classes/interfaces inherited from interface crow.game.codec.Context
Context.Source -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final PacketHandler<Ping>protected final PacketHandler<Pong> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<PacketHandler<?>>lookupPacketHandler(int prefix) List<PacketHandler<?>>lookupPacketHandler(Class<?> clz) intMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface crow.game.codec.Context
matchesPacketVersion
-
Field Details
-
pingPacketHandler
-
pongPacketHandler
-
-
Constructor Details
-
RootContext
public RootContext()
-
-
Method Details
-
callingSource
- Specified by:
callingSourcein interfaceContext- Returns:
- the location of the codec workflow this context was built in.
-
supportedProtocolVersion
public int supportedProtocolVersion()- Specified by:
supportedProtocolVersionin interfaceContext- Returns:
- the current RO protocol version as an integer.
-
lookupPacketHandler
- Specified by:
lookupPacketHandlerin interfaceContext
-
lookupPacketHandler
- Specified by:
lookupPacketHandlerin interfaceContext
-
underlyingObject
- Specified by:
underlyingObjectin interfaceContext- Returns:
- the underlying object, usually a Netty connection object.
-