From ed9695ab498f71e9851d32996fd679e80abb28b0 Mon Sep 17 00:00:00 2001 From: Joffrey BION Date: Sun, 22 Jan 2017 11:41:46 +0100 Subject: Add validation constraints on PlayerMove --- .../sevenwonders/actions/PrepareCardAction.java | 3 +++ .../luxons/sevenwonders/game/api/PlayerMove.java | 24 +++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/backend/src/main/java/org/luxons/sevenwonders/actions/PrepareCardAction.java b/backend/src/main/java/org/luxons/sevenwonders/actions/PrepareCardAction.java index b333d6c1..2fa857ad 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/actions/PrepareCardAction.java +++ b/backend/src/main/java/org/luxons/sevenwonders/actions/PrepareCardAction.java @@ -1,9 +1,12 @@ package org.luxons.sevenwonders.actions; +import javax.validation.constraints.NotNull; + import org.luxons.sevenwonders.game.api.PlayerMove; public class PrepareCardAction { + @NotNull private PlayerMove move; public PlayerMove getMove() { diff --git a/backend/src/main/java/org/luxons/sevenwonders/game/api/PlayerMove.java b/backend/src/main/java/org/luxons/sevenwonders/game/api/PlayerMove.java index 6d2889e0..28b64fbb 100644 --- a/backend/src/main/java/org/luxons/sevenwonders/game/api/PlayerMove.java +++ b/backend/src/main/java/org/luxons/sevenwonders/game/api/PlayerMove.java @@ -3,24 +3,20 @@ package org.luxons.sevenwonders.game.api; import java.util.ArrayList; import java.util.List; +import javax.validation.constraints.NotNull; + import org.luxons.sevenwonders.game.moves.MoveType; import org.luxons.sevenwonders.game.resources.BoughtResources; public class PlayerMove { - private String cardName; - + @NotNull private MoveType type; - private List boughtResources = new ArrayList<>(); - - public String getCardName() { - return cardName; - } + @NotNull + private String cardName; - public void setCardName(String cardName) { - this.cardName = cardName; - } + private List boughtResources = new ArrayList<>(); public MoveType getType() { return type; @@ -30,6 +26,14 @@ public class PlayerMove { this.type = type; } + public String getCardName() { + return cardName; + } + + public void setCardName(String cardName) { + this.cardName = cardName; + } + public List getBoughtResources() { return boughtResources; } -- cgit