[LIB-8] URL and HTML tag processing, new entities fields
[snooker-score-api.git] / src / main / java / org / hedgecode / snooker / json / JsonRound.java
1 /*
2  * Copyright (c) 2017-2019. Developed by Hedgecode.
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.hedgecode.snooker.json;
18
19 import com.google.gson.annotations.Expose;
20 import com.google.gson.annotations.SerializedName;
21
22 import org.hedgecode.snooker.annotation.WithHTMLTags;
23 import org.hedgecode.snooker.api.Event;
24 import org.hedgecode.snooker.api.Round;
25
26 /**
27  * Round Entity to JSON deserialize.
28  *
29  * @author Dmitry Samoshin aka gotty
30  */
31 public class JsonRound extends JsonIdEntity implements Round {
32
33     @SerializedName("Round")
34     private int round;
35     @SerializedName("RoundName")
36     private String roundName;
37     @SerializedName("EventID")
38     private int eventId;
39     @Expose
40     private Event event;
41     @SerializedName("MainEvent")
42     private int mainEventId;
43     @Expose
44     private Event mainEvent;
45     @SerializedName("Distance")
46     private int distance;
47     @SerializedName("NumLeft")
48     private int numLeft;
49     @SerializedName("NumMatches")
50     private int numMatches;
51     @WithHTMLTags
52     @SerializedName("Note")
53     private String note;
54     @SerializedName("ValueType")
55     private String valueType;
56     @SerializedName("Rank")
57     private int rank;
58     @SerializedName("Money")
59     private long money;
60     @SerializedName("SeedGetsHalf")
61     private int seedGetsHalf;
62     @SerializedName("ActualMoney")
63     private long actualMoney;
64     @SerializedName("Currency")
65     private String currency;
66     @SerializedName("ConversionRate")
67     private int conversionRate;
68     @SerializedName("Points")
69     private int points;
70     @SerializedName("SeedPoints")
71     private int seedPoints;
72
73     protected JsonRound() {
74     }
75
76     @Override
77     public int round() {
78         return round;
79     }
80
81     @Override
82     public String roundName() {
83         return roundName;
84     }
85
86     @Override
87     public int eventId() {
88         return eventId;
89     }
90
91     @Override
92     public Event event() {
93         return event;
94     }
95
96     public void setEvent(Event event) {
97         if (event != null && eventId == event.eventId())
98             this.event = event;
99     }
100
101     @Override
102     public int mainEventId() {
103         return mainEventId;
104     }
105
106     @Override
107     public Event mainEvent() {
108         return mainEvent;
109     }
110
111     public void setMainEvent(Event mainEvent) {
112         if (mainEvent != null && mainEventId == mainEvent.eventId())
113             this.mainEvent = mainEvent;
114     }
115
116     @Override
117     public int distance() {
118         return distance;
119     }
120
121     @Override
122     public int numLeft() {
123         return numLeft;
124     }
125
126     @Override
127     public int numMatches() {
128         return numMatches;
129     }
130
131     @Override
132     public String note() {
133         return note;
134     }
135
136     @Override
137     public String valueType() {
138         return valueType;
139     }
140
141     @Override
142     public int rank() {
143         return rank;
144     }
145
146     @Override
147     public long money() {
148         return money;
149     }
150
151     @Override
152     public int seedGetsHalf() {
153         return seedGetsHalf;
154     }
155
156     @Override
157     public long actualMoney() {
158         return actualMoney;
159     }
160
161     @Override
162     public String currency() {
163         return currency;
164     }
165
166     @Override
167     public int conversionRate() {
168         return conversionRate;
169     }
170
171     @Override
172     public int points() {
173         return points;
174     }
175
176     @Override
177     public int seedPoints() {
178         return seedPoints;
179     }
180
181     @Override
182     public int getId() {
183         return round;
184     }
185
186 }