From 1cf48f9f04fd8a324cb29adfe05a02d87c70d2eb Mon Sep 17 00:00:00 2001 From: Daniel Gerhardt <code@dgerhardt.net> Date: Tue, 28 Mar 2017 12:43:32 +0200 Subject: [PATCH] Use interface instead of implementation as return type --- .../arsnova/controller/ConfigurationController.java | 13 +++++++------ .../java/de/thm/arsnova/events/LockVoteEvent.java | 5 +++-- .../arsnova/events/PiRoundDelayedStartEvent.java | 5 +++-- .../java/de/thm/arsnova/events/PiRoundEndEvent.java | 5 +++-- .../de/thm/arsnova/events/PiRoundResetEvent.java | 5 +++-- .../java/de/thm/arsnova/events/UnlockVoteEvent.java | 5 +++-- 6 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/main/java/de/thm/arsnova/controller/ConfigurationController.java b/src/main/java/de/thm/arsnova/controller/ConfigurationController.java index 134eda8b4..8956c1ea0 100644 --- a/src/main/java/de/thm/arsnova/controller/ConfigurationController.java +++ b/src/main/java/de/thm/arsnova/controller/ConfigurationController.java @@ -27,6 +27,7 @@ import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; import java.util.HashMap; +import java.util.Map; /** * The ConfigurationController provides frontend clients with information necessary to correctly interact with the @@ -161,11 +162,11 @@ public class ConfigurationController extends AbstractController { @RequestMapping(method = RequestMethod.GET) @ResponseBody - public HashMap<String, Object> getConfiguration(HttpServletRequest request) { - HashMap<String, Object> config = new HashMap<>(); - HashMap<String, Boolean> features = new HashMap<>(); - HashMap<String, String> publicPool = new HashMap<>(); - HashMap<String, Object> splashscreen = new HashMap<>(); + public Map<String, Object> getConfiguration(HttpServletRequest request) { + Map<String, Object> config = new HashMap<>(); + Map<String, Boolean> features = new HashMap<>(); + Map<String, String> publicPool = new HashMap<>(); + Map<String, Object> splashscreen = new HashMap<>(); /* The API path could be unknown to the client in case the request was forwarded */ if ("".equals(apiPath)) { @@ -268,7 +269,7 @@ public class ConfigurationController extends AbstractController { } if (!"".equals(trackingTrackerUrl)) { - HashMap<String, String> tracking = new HashMap<>(); + Map<String, String> tracking = new HashMap<>(); config.put("tracking", tracking); tracking.put("provider", trackingProvider); diff --git a/src/main/java/de/thm/arsnova/events/LockVoteEvent.java b/src/main/java/de/thm/arsnova/events/LockVoteEvent.java index a3831c998..b33922f4f 100644 --- a/src/main/java/de/thm/arsnova/events/LockVoteEvent.java +++ b/src/main/java/de/thm/arsnova/events/LockVoteEvent.java @@ -21,6 +21,7 @@ import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; import java.util.HashMap; +import java.util.Map; /** * Fires whenever voting on a question is disabled. @@ -48,8 +49,8 @@ public class LockVoteEvent extends SessionEvent { return this.question.isVotingDisabled(); } - public HashMap<String, Object> getVotingAdmission() { - HashMap<String, Object> map = new HashMap<>(); + public Map<String, Object> getVotingAdmission() { + Map<String, Object> map = new HashMap<>(); map.put("_id", getQuestionId()); map.put("variant", getQuestionVariant()); diff --git a/src/main/java/de/thm/arsnova/events/PiRoundDelayedStartEvent.java b/src/main/java/de/thm/arsnova/events/PiRoundDelayedStartEvent.java index 6b3418d9a..6fdc587e3 100644 --- a/src/main/java/de/thm/arsnova/events/PiRoundDelayedStartEvent.java +++ b/src/main/java/de/thm/arsnova/events/PiRoundDelayedStartEvent.java @@ -21,6 +21,7 @@ import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; import java.util.HashMap; +import java.util.Map; /** * Fires whenever a delayed peer instruction round is initiated. The delayed part denotes that this round might not @@ -69,8 +70,8 @@ public class PiRoundDelayedStartEvent extends SessionEvent { return piRound; } - public HashMap<String, Object> getPiRoundInformations() { - HashMap<String, Object> map = new HashMap<>(); + public Map<String, Object> getPiRoundInformations() { + Map<String, Object> map = new HashMap<>(); map.put("_id", getQuestionId()); map.put("endTime", getEndTime()); diff --git a/src/main/java/de/thm/arsnova/events/PiRoundEndEvent.java b/src/main/java/de/thm/arsnova/events/PiRoundEndEvent.java index 0d1d5df83..b87d12590 100644 --- a/src/main/java/de/thm/arsnova/events/PiRoundEndEvent.java +++ b/src/main/java/de/thm/arsnova/events/PiRoundEndEvent.java @@ -21,6 +21,7 @@ import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; import java.util.HashMap; +import java.util.Map; /** * Fires whenever a peer instruction round has ended. @@ -51,8 +52,8 @@ public class PiRoundEndEvent extends SessionEvent { return questionVariant; } - public HashMap<String, String> getPiRoundEndInformations() { - HashMap<String, String> map = new HashMap<>(); + public Map<String, String> getPiRoundEndInformations() { + Map<String, String> map = new HashMap<>(); map.put("_id", getQuestionId()); map.put("variant", getQuestionVariant()); diff --git a/src/main/java/de/thm/arsnova/events/PiRoundResetEvent.java b/src/main/java/de/thm/arsnova/events/PiRoundResetEvent.java index 92a7095fc..429aeb274 100644 --- a/src/main/java/de/thm/arsnova/events/PiRoundResetEvent.java +++ b/src/main/java/de/thm/arsnova/events/PiRoundResetEvent.java @@ -21,6 +21,7 @@ import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; import java.util.HashMap; +import java.util.Map; /** * Fires whenever a peer instruction round is reset. @@ -51,8 +52,8 @@ public class PiRoundResetEvent extends SessionEvent { return questionVariant; } - public HashMap<String, String> getPiRoundResetInformations() { - HashMap<String, String> map = new HashMap<>(); + public Map<String, String> getPiRoundResetInformations() { + Map<String, String> map = new HashMap<>(); map.put("_id", getQuestionId()); map.put("variant", getQuestionVariant()); diff --git a/src/main/java/de/thm/arsnova/events/UnlockVoteEvent.java b/src/main/java/de/thm/arsnova/events/UnlockVoteEvent.java index ef3bf8c7b..69a1f4571 100644 --- a/src/main/java/de/thm/arsnova/events/UnlockVoteEvent.java +++ b/src/main/java/de/thm/arsnova/events/UnlockVoteEvent.java @@ -21,6 +21,7 @@ import de.thm.arsnova.entities.Question; import de.thm.arsnova.entities.Session; import java.util.HashMap; +import java.util.Map; /** * Fires whenever voting on a question is enabled. @@ -48,8 +49,8 @@ public class UnlockVoteEvent extends SessionEvent { return this.question.isVotingDisabled(); } - public HashMap<String, Object> getVotingAdmission() { - HashMap<String, Object> map = new HashMap<>(); + public Map<String, Object> getVotingAdmission() { + Map<String, Object> map = new HashMap<>(); map.put("_id", getQuestionId()); map.put("variant", getQuestionVariant()); -- GitLab