2 * Copyright (c) 2017. Developed by Hedgecode.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.hedgecode.snooker.json;
19 import com.google.gson.annotations.Expose;
20 import com.google.gson.annotations.SerializedName;
22 import org.hedgecode.snooker.api.Player;
23 import org.hedgecode.snooker.api.Ranking;
24 import org.hedgecode.snooker.api.RankingType;
25 import org.hedgecode.snooker.api.Season;
28 * Ranking Entity to JSON deserialize.
30 * @author Dmitry Samoshin aka gotty
32 public class JsonRanking extends JsonIdEntity implements Ranking {
35 private int rankingId;
36 @SerializedName("Position")
38 @SerializedName("PlayerID")
41 private Player player;
42 @SerializedName("Season")
43 private int seasonYear;
45 private Season season;
46 @SerializedName("Sum")
48 @SerializedName("Type")
51 private RankingType rankingType;
54 public int rankingId() {
59 public int position() {
64 public int playerId() {
69 public Player player() {
73 public void setPlayer(Player player) {
74 if (player != null && playerId == player.playerId())
79 public Season season() {
81 season = Season.getSeason(seasonYear);
91 public RankingType rankingType() {
92 if (rankingType == null)
93 rankingType = RankingType.byName(type);