Coverage Summary for Class: LobbyConnected (it.polimi.ingsw.Server.Messages.ServerResponses)
Class |
Class, %
|
Method, %
|
Line, %
|
LobbyConnected |
0%
(0/1)
|
0%
(0/5)
|
0%
(0/7)
|
1 package it.polimi.ingsw.Server.Messages.ServerResponses;
2
3 import it.polimi.ingsw.Server.Messages.ServerResponses.SupportStructures.StatusCode;
4
5 import java.io.Serial;
6 import java.util.UUID;
7
8 /**
9 * A {@link Response} to represent the output the controller gave on a previous {@link it.polimi.ingsw.Server.Messages.Events.Requests.ConnectLobbyRequest} or
10 * {@link it.polimi.ingsw.Server.Messages.Events.Requests.CreateLobbyRequest}
11 */
12 public class LobbyConnected extends Response {
13 @Serial
14 private static final long serialVersionUID = 310L;
15 private final UUID lobbyID;
16
17 private final String admin;
18
19 /**
20 * Construct the response
21 *
22 * @param statusCode the status code of the response
23 * @param lobbyID the UUID of the lobby
24 * @param admin the admin of the lobby
25 */
26 private LobbyConnected(StatusCode statusCode, UUID lobbyID, String admin) {
27 super(statusCode);
28 this.lobbyID = lobbyID;
29 this.admin = admin;
30 }
31
32 /**
33 * Returns a failed status code response
34 *
35 * @return a failed status code response
36 */
37 public static LobbyConnected fail() {
38 return new LobbyConnected(StatusCode.Fail, null, null);
39 }
40
41 /**
42 * Returns a successful status code response
43 *
44 * @param lobbyID the UUID of the successfully connected to lobby
45 * @param admin the admin of the lobby
46 * @return a successful status code response
47 */
48 public static LobbyConnected success(UUID lobbyID, String admin) {
49 return new LobbyConnected(StatusCode.Success, lobbyID, admin);
50 }
51
52 /**
53 * Get the id of the lobby
54 *
55 * @return the UUID of the lobby or null if no lobby was linked to the response
56 */
57 public UUID getLobbyID() {
58 return this.lobbyID;
59 }
60
61 /**
62 * Get the admin of the lobby
63 *
64 * @return the nickname of the admin of the lobby or null if no lobby was linked to the response
65 */
66 public String getAdmin() {
67 return admin;
68 }
69
70 }