Package io.hekate.network
Class NetworkServerHandlerConfig<T>
- java.lang.Object
-
- io.hekate.network.NetworkServerHandlerConfig<T>
-
- Type Parameters:
T
- Base type of messages that can be processed byNetworkServerHandler
.
- Direct Known Subclasses:
NettyServerHandlerConfig
public class NetworkServerHandlerConfig<T> extends Object
Configuration forNetworkServerHandler
.- See Also:
NetworkServerHandler
-
-
Constructor Summary
Constructors Constructor Description NetworkServerHandlerConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CodecFactory<T>
getCodecFactory()
Returns the codec factory that should be used for messages serialization (seesetCodecFactory(CodecFactory)
).NetworkServerHandler<T>
getHandler()
Returns the handler (seesetHandler(NetworkServerHandler)
.String
getLoggerCategory()
Returns the logger category that should be used byNetworkServerHandler
(seesetLoggerCategory(String)
).String
getProtocol()
Returns the protocol identifier (seesetProtocol(String)
).void
setCodecFactory(CodecFactory<T> codecFactory)
Sets the codec factory that should be used for messages serialization.void
setHandler(NetworkServerHandler<T> handler)
Sets the handler.void
setLoggerCategory(String loggerCategory)
Sets the logger category that should be used byNetworkServerHandler
.void
setProtocol(String protocol)
Sets the connector protocol identifier.String
toString()
NetworkServerHandlerConfig<T>
withCodecFactory(CodecFactory<T> codecFactory)
Fluent-style version ofsetCodecFactory(CodecFactory)
.NetworkServerHandlerConfig<T>
withHandler(NetworkServerHandler<T> handler)
Fluent-style version ofsetHandler(NetworkServerHandler)
.NetworkServerHandlerConfig<T>
withLoggerCategory(String loggerCategory)
Fluent-style version ofsetLoggerCategory(String)
.NetworkServerHandlerConfig<T>
withProtocol(String protocol)
Fluent-style version ofsetProtocol(String)
.
-
-
-
Method Detail
-
getProtocol
public String getProtocol()
Returns the protocol identifier (seesetProtocol(String)
).- Returns:
- Protocol identifier.
-
setProtocol
public void setProtocol(String protocol)
Sets the connector protocol identifier. Can contain only alpha-numeric characters and non-repeatable dots/hyphens.Only clients that have the same
protocol identifier
will be processed by theconfigured
NetworkServerHandler
.This parameter is mandatory and doesn't have a default value.
Note: Protocol identifier must be unique across all registered
NetworkServerHandlerConfig
s within theNetworkServer
.- Parameters:
protocol
- Protocol identifier (can contain only alpha-numeric characters and non-repeatable dots/hyphens).
-
withProtocol
public NetworkServerHandlerConfig<T> withProtocol(String protocol)
Fluent-style version ofsetProtocol(String)
.- Parameters:
protocol
- Protocol identifier.- Returns:
- This instance.
-
getCodecFactory
public CodecFactory<T> getCodecFactory()
Returns the codec factory that should be used for messages serialization (seesetCodecFactory(CodecFactory)
).- Returns:
- Codec factory.
-
setCodecFactory
public void setCodecFactory(CodecFactory<T> codecFactory)
Sets the codec factory that should be used for messages serialization.Only messages that are supported by the specified
CodecFactory
can be sent/received by the configuredNetworkServerHandler
. Note that the same factory must be configured on theclient side
.This parameter is mandatory and doesn't have a default value.
- Parameters:
codecFactory
- Codec factory.
-
withCodecFactory
public NetworkServerHandlerConfig<T> withCodecFactory(CodecFactory<T> codecFactory)
Fluent-style version ofsetCodecFactory(CodecFactory)
.- Parameters:
codecFactory
- Codec factory.- Returns:
- This instance.
-
getHandler
public NetworkServerHandler<T> getHandler()
Returns the handler (seesetHandler(NetworkServerHandler)
.- Returns:
- Handler.
-
setHandler
public void setHandler(NetworkServerHandler<T> handler)
Sets the handler.- Parameters:
handler
- Handler.
-
withHandler
public NetworkServerHandlerConfig<T> withHandler(NetworkServerHandler<T> handler)
Fluent-style version ofsetHandler(NetworkServerHandler)
.- Parameters:
handler
- Handler.- Returns:
- This instance.
-
getLoggerCategory
public String getLoggerCategory()
Returns the logger category that should be used byNetworkServerHandler
(seesetLoggerCategory(String)
).- Returns:
- Logger category.
-
setLoggerCategory
public void setLoggerCategory(String loggerCategory)
Sets the logger category that should be used byNetworkServerHandler
.- Parameters:
loggerCategory
- Logger category.
-
withLoggerCategory
public NetworkServerHandlerConfig<T> withLoggerCategory(String loggerCategory)
Fluent-style version ofsetLoggerCategory(String)
.- Parameters:
loggerCategory
- Logger category.- Returns:
- This instance.
-
-