diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2017-01-22 11:41:46 +0100 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2017-01-22 11:42:02 +0100 |
commit | ed9695ab498f71e9851d32996fd679e80abb28b0 (patch) | |
tree | 9a65e3b7e8e9d34bccc71db3db3c1cc1df2e0ea9 /backend/src/main/java/org/luxons | |
parent | Add section on frontend architecture (diff) | |
download | seven-wonders-ed9695ab498f71e9851d32996fd679e80abb28b0.tar.gz seven-wonders-ed9695ab498f71e9851d32996fd679e80abb28b0.tar.bz2 seven-wonders-ed9695ab498f71e9851d32996fd679e80abb28b0.zip |
Add validation constraints on PlayerMove
Diffstat (limited to 'backend/src/main/java/org/luxons')
-rw-r--r-- | backend/src/main/java/org/luxons/sevenwonders/actions/PrepareCardAction.java | 3 | ||||
-rw-r--r-- | backend/src/main/java/org/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> boughtResources = new ArrayList<>(); - - public String getCardName() { - return cardName; - } + @NotNull + private String cardName; - public void setCardName(String cardName) { - this.cardName = cardName; - } + private List<BoughtResources> 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<BoughtResources> getBoughtResources() { return boughtResources; } |