2 * Copyright (c) 2017-2020. 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 java.io.Serializable;
21 import com.google.gson.annotations.Expose;
22 import com.google.gson.annotations.SerializedName;
24 import org.hedgecode.snooker.api.Player;
25 import org.hedgecode.snooker.api.Ranking;
26 import org.hedgecode.snooker.api.RankingType;
27 import org.hedgecode.snooker.api.Season;
30 * Ranking Entity to JSON deserialize.
32 * @author Dmitry Samoshin aka gotty
34 public class JsonRanking extends JsonIdEntity implements Ranking, Serializable {
36 private static final long serialVersionUID = -8009582917499815478L;
39 private int rankingId;
40 @SerializedName("Position")
42 @SerializedName("PlayerID")
45 private Player player;
46 @SerializedName("Season")
47 private int seasonYear;
49 private Season season;
50 @SerializedName("Sum")
52 @SerializedName("Type")
55 private RankingType rankingType;
61 public int rankingId() {
66 public int position() {
71 public int playerId() {
76 public Player player() {
80 public void setPlayer(Player player) {
81 if (player != null && playerId == player.playerId())
86 public Season season() {
88 season = Season.getSeason(seasonYear);
98 public RankingType rankingType() {
99 if (rankingType == null)
100 rankingType = RankingType.byName(type);