Docs: Applied Spotless to JoinLobby command

This commit is contained in:
Jona Walpert
2026-04-11 19:30:54 +02:00
parent 2c6ecdc0f9
commit de0d0f93f8
3 changed files with 17 additions and 21 deletions
@@ -13,12 +13,10 @@ import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.response.dispatch
/**
* Handler for the `JOIN_LOBBY` command.
*
* <p>
* Resolves the username from the session (requires {@link UserLoggedInCheck}),
* looks up the target lobby and attempts to add the user. On success an
* `+OK` response is dispatched; on failure an appropriate {@link ErrorResponse}
* with one of the error codes `LOBBY_NOT_FOUND`, `USER_NOT_LOGGED_IN` or
* `LOBBY_FULL_OR_ALREADY_IN` is returned.
* <p>Resolves the username from the session (requires {@link UserLoggedInCheck}), looks up the
* target lobby and attempts to add the user. On success an `+OK` response is dispatched; on failure
* an appropriate {@link ErrorResponse} with one of the error codes `LOBBY_NOT_FOUND`,
* `USER_NOT_LOGGED_IN` or `LOBBY_FULL_OR_ALREADY_IN` is returned.
*/
public class JoinLobbyHandler extends CommandHandler<JoinLobbyRequest> {
private final LobbyManager lobbyManager;
@@ -27,10 +25,9 @@ public class JoinLobbyHandler extends CommandHandler<JoinLobbyRequest> {
/**
* Create a new {@link JoinLobbyHandler}.
*
* @param responseDispatcher dispatcher used to send responses back to the
* client
* @param lobbyManager manager providing lobby state and operations
* @param userRegistry registry to resolve session -> user mappings
* @param responseDispatcher dispatcher used to send responses back to the client
* @param lobbyManager manager providing lobby state and operations
* @param userRegistry registry to resolve session -> user mappings
*/
public JoinLobbyHandler(
ResponseDispatcher responseDispatcher,
@@ -7,15 +7,14 @@ import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.request.accessor.
/**
* Parser for the `JOIN_LOBBY` command.
*
* <p>
* Expected request parameters:
* <p>Expected request parameters:
*
* <ul>
* <li>`ID` (int) — numeric lobby identifier (required)
* <li>`ID` (int) — numeric lobby identifier (required)
* </ul>
*
* <p>
* The parser builds a {@link JoinLobbyRequest} containing the parsed lobby id
* and the original request context.
* <p>The parser builds a {@link JoinLobbyRequest} containing the parsed lobby id and the original
* request context.
*/
public class JoinLobbyParser implements CommandParser<JoinLobbyRequest> {
/**
@@ -26,7 +25,8 @@ public class JoinLobbyParser implements CommandParser<JoinLobbyRequest> {
*/
@Override
public JoinLobbyRequest parse(PrimitiveRequest primitiveRequest) {
RequestParameterAccessor accessor = new RequestParameterAccessor(primitiveRequest.parameters());
RequestParameterAccessor accessor =
new RequestParameterAccessor(primitiveRequest.parameters());
int id = accessor.require("ID", Integer::parseInt);
return new JoinLobbyRequest(primitiveRequest.context(), id);
}
@@ -6,9 +6,8 @@ import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.request.RequestCo
/**
* Request data for the `JOIN_LOBBY` command.
*
* <p>
* Contains the lobby id the client wants to join and inherits the
* {@link Request} contextual information.
* <p>Contains the lobby id the client wants to join and inherits the {@link Request} contextual
* information.
*/
public class JoinLobbyRequest extends Request {
private final int id;
@@ -17,7 +16,7 @@ public class JoinLobbyRequest extends Request {
* Create a new {@link JoinLobbyRequest}.
*
* @param context the request context
* @param id numeric lobby id to join
* @param id numeric lobby id to join
*/
public JoinLobbyRequest(RequestContext context, int id) {
super(context);