From 7b53d62261b9e0fcddf4bd9e180e2ccdd25388ca Mon Sep 17 00:00:00 2001 From: jbion Date: Wed, 27 Feb 2019 01:29:47 +0100 Subject: Remove unnecessary Jackson annotation on non-DTOs --- backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Lobby.kt | 2 +- .../src/main/kotlin/org/luxons/sevenwonders/lobby/Player.kt | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) (limited to 'backend') diff --git a/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Lobby.kt b/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Lobby.kt index 8498ce85..08249193 100644 --- a/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Lobby.kt +++ b/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Lobby.kt @@ -12,7 +12,7 @@ class Lobby( val id: Long, val name: String, var owner: Player, - @field:Transient private val gameDefinition: GameDefinition + private val gameDefinition: GameDefinition ) { private val players: MutableList = ArrayList(gameDefinition.maxPlayers) diff --git a/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Player.kt b/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Player.kt index 4f70468f..d6e9b344 100644 --- a/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Player.kt +++ b/backend/src/main/kotlin/org/luxons/sevenwonders/lobby/Player.kt @@ -1,6 +1,5 @@ package org.luxons.sevenwonders.lobby -import com.fasterxml.jackson.annotation.JsonIgnore import org.luxons.sevenwonders.errors.ApiMisuseException import org.luxons.sevenwonders.game.Game @@ -21,21 +20,16 @@ class Player( val isInGame: Boolean get() = _game != null - @Transient private var _lobby: Lobby? = null - @get:JsonIgnore val lobby: Lobby get() = _lobby ?: throw PlayerNotInLobbyException(username) - @get:JsonIgnore val ownedLobby: Lobby get() = if (isGameOwner) lobby else throw PlayerIsNotOwnerException(username) - @Transient private var _game: Game? = null - @get:JsonIgnore val game: Game get() = _game ?: throw PlayerNotInGameException(username) @@ -54,9 +48,7 @@ class Player( index = -1 } - override fun toString(): String { - return "'$displayName' ($username)" - } + override fun toString(): String = "'$displayName' ($username)" } internal class PlayerNotInLobbyException(username: String) : -- cgit