public final class ServerMethodDefinition<RequestT,ResponseT> extends Object
HandlerRegistry
and exposed
by a Server
.Modifier and Type | Method and Description |
---|---|
static <RequestT,ResponseT> |
create(String name,
Marshaller<RequestT> requestMarshaller,
Marshaller<ResponseT> responseMarshaller,
ServerCallHandler<RequestT,ResponseT> handler)
Create a new instance.
|
String |
getName()
The simple name of the method.
|
ServerCallHandler<RequestT,ResponseT> |
getServerCallHandler()
Handler for incoming calls.
|
RequestT |
parseRequest(InputStream input)
Parse an incoming request message.
|
InputStream |
streamResponse(ResponseT response)
Serialize an outgoing response message.
|
ServerMethodDefinition<RequestT,ResponseT> |
withServerCallHandler(ServerCallHandler<RequestT,ResponseT> handler)
Create a new method definition with a different call handler.
|
public static <RequestT,ResponseT> ServerMethodDefinition<RequestT,ResponseT> create(String name, Marshaller<RequestT> requestMarshaller, Marshaller<ResponseT> responseMarshaller, ServerCallHandler<RequestT,ResponseT> handler)
name
- the simple name of a method.requestMarshaller
- marshaller for request messages.responseMarshaller
- marshaller for response messages.handler
- to dispatch calls to.public String getName()
public RequestT parseRequest(InputStream input)
input
- the serialized message as a byte stream.public InputStream streamResponse(ResponseT response)
response
- the response message to serialize.public ServerCallHandler<RequestT,ResponseT> getServerCallHandler()
public ServerMethodDefinition<RequestT,ResponseT> withServerCallHandler(ServerCallHandler<RequestT,ResponseT> handler)
handler
- to bind to a cloned instance of this.