Refactor: Existing handler to using constructor of superclass
This commit is contained in:
+1
-2
@@ -8,7 +8,6 @@ import java.util.Optional;
|
|||||||
|
|
||||||
/** Handles {@link CheckUsernameRequest}s to check whether a username is available. */
|
/** Handles {@link CheckUsernameRequest}s to check whether a username is available. */
|
||||||
public class CheckUsernameHandler extends CommandHandler<CheckUsernameRequest> {
|
public class CheckUsernameHandler extends CommandHandler<CheckUsernameRequest> {
|
||||||
private final ResponseDispatcher responseDispatcher;
|
|
||||||
private final UserRegistry userRegistry;
|
private final UserRegistry userRegistry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,7 +17,7 @@ public class CheckUsernameHandler extends CommandHandler<CheckUsernameRequest> {
|
|||||||
* @param userRegistry the registry used to look up existing users
|
* @param userRegistry the registry used to look up existing users
|
||||||
*/
|
*/
|
||||||
public CheckUsernameHandler(ResponseDispatcher responseDispatcher, UserRegistry userRegistry) {
|
public CheckUsernameHandler(ResponseDispatcher responseDispatcher, UserRegistry userRegistry) {
|
||||||
this.responseDispatcher = responseDispatcher;
|
super(responseDispatcher);
|
||||||
this.userRegistry = userRegistry;
|
this.userRegistry = userRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -14,7 +14,6 @@ import java.util.Optional;
|
|||||||
* already
|
* already
|
||||||
*/
|
*/
|
||||||
public class LoginHandler extends CommandHandler<LoginRequest> {
|
public class LoginHandler extends CommandHandler<LoginRequest> {
|
||||||
private final ResponseDispatcher responseDispatcher;
|
|
||||||
private final UserRegistry userRegistry;
|
private final UserRegistry userRegistry;
|
||||||
private final UserFactory userFactory;
|
private final UserFactory userFactory;
|
||||||
|
|
||||||
@@ -25,7 +24,7 @@ public class LoginHandler extends CommandHandler<LoginRequest> {
|
|||||||
* @param userRegistry the registry used to look up existing users and create the new one
|
* @param userRegistry the registry used to look up existing users and create the new one
|
||||||
*/
|
*/
|
||||||
public LoginHandler(ResponseDispatcher responseDispatcher, UserRegistry userRegistry) {
|
public LoginHandler(ResponseDispatcher responseDispatcher, UserRegistry userRegistry) {
|
||||||
this.responseDispatcher = responseDispatcher;
|
super(responseDispatcher);
|
||||||
this.userRegistry = userRegistry;
|
this.userRegistry = userRegistry;
|
||||||
this.userFactory = new UserFactory(userRegistry);
|
this.userFactory = new UserFactory(userRegistry);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -8,7 +8,6 @@ import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.response.dispatch
|
|||||||
|
|
||||||
/** Handles {@link LogoutRequest} to logout connected user. */
|
/** Handles {@link LogoutRequest} to logout connected user. */
|
||||||
public class LogoutHandler extends CommandHandler<LogoutRequest> {
|
public class LogoutHandler extends CommandHandler<LogoutRequest> {
|
||||||
private final ResponseDispatcher responseDispatcher;
|
|
||||||
private final UserRegistry userRegistry;
|
private final UserRegistry userRegistry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,7 +17,7 @@ public class LogoutHandler extends CommandHandler<LogoutRequest> {
|
|||||||
* @param userRegistry registry responsible for tracking connected user sessions
|
* @param userRegistry registry responsible for tracking connected user sessions
|
||||||
*/
|
*/
|
||||||
public LogoutHandler(ResponseDispatcher responseDispatcher, UserRegistry userRegistry) {
|
public LogoutHandler(ResponseDispatcher responseDispatcher, UserRegistry userRegistry) {
|
||||||
this.responseDispatcher = responseDispatcher;
|
super(responseDispatcher);
|
||||||
this.userRegistry = userRegistry;
|
this.userRegistry = userRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -6,7 +6,6 @@ import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.response.dispatch
|
|||||||
|
|
||||||
/** Handler for {@link PingRequest}. */
|
/** Handler for {@link PingRequest}. */
|
||||||
public class PingHandler extends CommandHandler<PingRequest> {
|
public class PingHandler extends CommandHandler<PingRequest> {
|
||||||
private final ResponseDispatcher responseDispatcher;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PingHandler to execute {@link PingRequest}s
|
* Create a new PingHandler to execute {@link PingRequest}s
|
||||||
@@ -14,7 +13,7 @@ public class PingHandler extends CommandHandler<PingRequest> {
|
|||||||
* @param responseDispatcher dispatcher used to send responses back to clients
|
* @param responseDispatcher dispatcher used to send responses back to clients
|
||||||
*/
|
*/
|
||||||
public PingHandler(ResponseDispatcher responseDispatcher) {
|
public PingHandler(ResponseDispatcher responseDispatcher) {
|
||||||
this.responseDispatcher = responseDispatcher;
|
super(responseDispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user