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;
20 import java.util.Date;
22 import com.google.gson.annotations.Expose;
23 import com.google.gson.annotations.SerializedName;
25 import org.hedgecode.snooker.annotation.IsURL;
26 import org.hedgecode.snooker.annotation.WithHTMLTags;
27 import org.hedgecode.snooker.api.Event;
28 import org.hedgecode.snooker.api.Match;
29 import org.hedgecode.snooker.api.Player;
32 * Match Entity to JSON deserialize.
34 * @author Dmitry Samoshin aka gotty
36 public class JsonMatch extends JsonIdEntity implements Match, Serializable {
38 private static final long serialVersionUID = 1503003854433798119L;
42 @SerializedName("EventID")
46 @SerializedName("Round")
48 @SerializedName("Number")
50 @SerializedName("Player1ID")
51 private int player1Id;
53 private Player player1;
54 @SerializedName("Score1")
56 @SerializedName("Walkover1")
57 private boolean walkover1;
58 @SerializedName("Player2ID")
59 private int player2Id;
61 private Player player2;
62 @SerializedName("Score2")
64 @SerializedName("Walkover2")
65 private boolean walkover2;
66 @SerializedName("WinnerID")
69 private Player winner;
70 @SerializedName("Unfinished")
71 private boolean unfinished;
72 @SerializedName("OnBreak")
73 private boolean onBreak;
74 @SerializedName("WorldSnookerID")
75 private int worldSnookerId;
77 @SerializedName("LiveUrl")
78 private String liveUrl;
80 @SerializedName("DetailsUrl")
81 private String detailsUrl;
82 @SerializedName("PointsDropped")
83 private boolean pointsDropped;
84 @SerializedName("ShowCommonNote")
85 private boolean showCommonNote;
86 @SerializedName("Estimated")
87 private boolean estimated;
88 @SerializedName("Type")
90 @SerializedName("TableNo")
93 @SerializedName("VideoURL")
94 private String videoUrl;
95 @SerializedName("InitDate")
96 private Date initDate;
97 @SerializedName("ModDate")
99 @SerializedName("StartDate")
100 private Date startDate;
101 @SerializedName("EndDate")
102 private Date endDate;
103 @SerializedName("ScheduledDate")
104 private Date scheduledDate;
106 @SerializedName("FrameScores")
107 private String frameScores;
109 @SerializedName("Sessions")
110 private String sessions;
112 @SerializedName("Note")
115 @SerializedName("ExtendedNote")
116 private String extendedNote;
122 public int matchId() {
127 public int eventId() {
132 public Event event() {
136 public void setEvent(Event event) {
137 if (event != null && eventId == event.eventId())
147 public int number() {
152 public int player1Id() {
157 public Player player1() {
161 public void setPlayer1(Player player) {
162 if (player != null && player1Id == player.playerId())
163 this.player1 = player;
167 public int score1() {
172 public boolean walkover1() {
177 public int player2Id() {
182 public Player player2() {
186 public void setPlayer2(Player player) {
187 if (player != null && player2Id == player.playerId())
188 this.player2 = player;
192 public int score2() {
197 public boolean walkover2() {
202 public int winnerId() {
207 public Player winner() {
211 public void setWinner(Player winner) {
212 if (winner != null && winnerId == winner.playerId())
213 this.winner = winner;
217 public boolean unfinished() {
222 public boolean onBreak() {
227 public int worldSnookerId() {
228 return worldSnookerId;
232 public String liveUrl() {
237 public String detailsUrl() {
242 public boolean pointsDropped() {
243 return pointsDropped;
247 public boolean showCommonNote() {
248 return showCommonNote;
252 public boolean estimated() {
262 public int tableNo() {
267 public String videoUrl() {
272 public Date initDate() {
273 return initDate == null
275 : new Date(initDate.getTime());
279 public Date modDate() {
280 return modDate == null
282 : new Date(modDate.getTime());
286 public Date startDate() {
287 return startDate == null
289 : new Date(startDate.getTime());
293 public Date endDate() {
294 return endDate == null
296 : new Date(endDate.getTime());
300 public Date scheduledDate() {
301 return scheduledDate == null
303 : new Date(scheduledDate.getTime());
307 public String frameScores() {
312 public String sessions() {
317 public String note() {
322 public String extendedNote() {