public final class ServerResponse extends Object
Represents responses sent from the server to the client in response to a
client Command
, a user registration, or a user deregistration. A
ServerResponse
consists of a base Command
in the same form
as those sent from the client to server, along with an additional sender
which indicates the sender whose action generated the response.
There are generally two use cases for this class: first, for responses
that involve relaying a client Command
back to the sender, and
possibly also to other clients; and second, for responses like ERROR
that are generated by the server. See the protocol
specification for more details.
You should not edit this file.
Constructor and Description |
---|
ServerResponse(String sender,
Command.Type commandType,
String payload)
A convenience constructor which builds a new
Command without
parameters from its (other) components to create the ServerResponse . |
ServerResponse(String sender,
Command.Type commandType,
String p0,
String p1,
String payload)
A convenience constructor which builds a new
Command from its
components to create the ServerResponse . |
ServerResponse(String sender,
Command command)
|
public ServerResponse(String sender, Command command)
sender
- the sender whose action generated this responsecommand
- the base commandIllegalArgumentException
- if sender
or command
is null
public ServerResponse(String sender, Command.Type commandType, String p0, String p1, String payload)
Command
from its
components to create the ServerResponse
.sender
- the sender whose action generated this responsecommandType
- the command typep0
- the first parameter, or null
if absentp1
- the second parameter, or null
if absentpayload
- the payload, or null
if absentIllegalArgumentException
- if sender
is null
, or if the command is
syntactically invalid; see Command
for detailsCommand.Command(Command.Type, String, String, String)
public ServerResponse(String sender, Command.Type commandType, String payload)
Command
without
parameters from its (other) components to create the ServerResponse
.sender
- the sender whose action generated this responsecommandType
- the command typepayload
- the payload, or null
if absentIllegalArgumentException
- if sender
is null
, or if the command is
syntactically invalid; see Command
for detailsCommand.Command(Command.Type, String)