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 java.util.Date;
21 import com.google.gson.annotations.Expose;
22 import com.google.gson.annotations.SerializedName;
24 import org.hedgecode.snooker.api.Event;
25 import org.hedgecode.snooker.api.Match;
26 import org.hedgecode.snooker.api.Player;
29 * Match Entity to JSON deserialize.
31 * @author Dmitry Samoshin aka gotty
33 public class JsonMatch extends JsonIdEntity implements Match {
37 @SerializedName("EventID")
41 @SerializedName("Round")
43 @SerializedName("Number")
45 @SerializedName("Player1ID")
46 private int player1Id;
48 private Player player1;
49 @SerializedName("Score1")
51 @SerializedName("Walkover1")
52 private boolean walkover1;
53 @SerializedName("Player2ID")
54 private int player2Id;
56 private Player player2;
57 @SerializedName("Score2")
59 @SerializedName("Walkover2")
60 private boolean walkover2;
61 @SerializedName("WinnerID")
64 private Player winner;
65 @SerializedName("Unfinished")
66 private boolean unfinished;
67 @SerializedName("OnBreak")
68 private boolean onBreak;
69 @SerializedName("WorldSnookerID")
70 private int worldSnookerId;
71 @SerializedName("LiveUrl")
72 private String liveUrl;
73 @SerializedName("DetailsUrl")
74 private String detailsUrl;
75 @SerializedName("PointsDropped")
76 private boolean pointsDropped;
77 @SerializedName("ShowCommonNote")
78 private boolean showCommonNote;
79 @SerializedName("Estimated")
80 private boolean estimated;
81 @SerializedName("Type")
83 @SerializedName("TableNo")
85 @SerializedName("VideoURL")
86 private String videoURL;
87 @SerializedName("InitDate")
88 private Date initDate;
89 @SerializedName("ModDate")
91 @SerializedName("StartDate")
92 private Date startDate;
93 @SerializedName("EndDate")
95 @SerializedName("ScheduledDate")
96 private Date scheduledDate;
97 @SerializedName("FrameScores")
98 private String frameScores;
99 @SerializedName("Sessions")
100 private String sessions;
101 @SerializedName("Note")
103 @SerializedName("ExtendedNote")
104 private String extendedNote;
107 public int matchId() {
112 public int eventId() {
117 public Event event() {
121 public void setEvent(Event event) {
122 if (event != null && eventId == event.eventId())
132 public int number() {
137 public int player1Id() {
142 public Player player1() {
146 public void setPlayer1(Player player) {
147 if (player != null && player1Id == player.playerId())
148 this.player1 = player;
152 public int score1() {
157 public boolean walkover1() {
162 public int player2Id() {
167 public Player player2() {
171 public void setPlayer2(Player player) {
172 if (player != null && player2Id == player.playerId())
173 this.player2 = player;
177 public int score2() {
182 public boolean walkover2() {
187 public int winnerId() {
192 public Player winner() {
196 public void setWinner(Player winner) {
197 if (winner != null && winnerId == winner.playerId())
198 this.winner = winner;
202 public boolean unfinished() {
207 public boolean onBreak() {
212 public int worldSnookerId() {
213 return worldSnookerId;
217 public String liveUrl() {
222 public String detailsUrl() {
227 public boolean pointsDropped() {
228 return pointsDropped;
232 public boolean showCommonNote() {
233 return showCommonNote;
237 public boolean estimated() {
247 public int tableNo() {
252 public String videoURL() {
257 public Date initDate() {
262 public Date modDate() {
267 public Date startDate() {
272 public Date endDate() {
277 public Date scheduledDate() {
278 return scheduledDate;
282 public String frameScores() {
287 public String sessions() {
292 public String note() {
297 public String extendedNote() {