[LIB-10] SerialVersionUID for Serializable classes
[snooker-score-api.git] / src / main / java / org / hedgecode / snooker / json / JsonMatch.java
index 2731565..3a2ad3d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017. Developed by Hedgecode.
+ * Copyright (c) 2017-2020. Developed by Hedgecode.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 package org.hedgecode.snooker.json;
 
+import java.io.Serializable;
 import java.util.Date;
 
 import com.google.gson.annotations.Expose;
 import com.google.gson.annotations.SerializedName;
 
+import org.hedgecode.snooker.annotation.IsURL;
+import org.hedgecode.snooker.annotation.WithHTMLTags;
 import org.hedgecode.snooker.api.Event;
 import org.hedgecode.snooker.api.Match;
 import org.hedgecode.snooker.api.Player;
@@ -30,7 +33,9 @@ import org.hedgecode.snooker.api.Player;
  *
  * @author Dmitry Samoshin aka gotty
  */
-public class JsonMatch extends JsonIdEntity implements Match {
+public class JsonMatch extends JsonIdEntity implements Match, Serializable {
+
+    private static final long serialVersionUID = 1503003854433798119L;
 
     @SerializedName("ID")
     private int matchId;
@@ -68,8 +73,10 @@ public class JsonMatch extends JsonIdEntity implements Match {
     private boolean onBreak;
     @SerializedName("WorldSnookerID")
     private int worldSnookerId;
+    @IsURL
     @SerializedName("LiveUrl")
     private String liveUrl;
+    @IsURL
     @SerializedName("DetailsUrl")
     private String detailsUrl;
     @SerializedName("PointsDropped")
@@ -82,8 +89,9 @@ public class JsonMatch extends JsonIdEntity implements Match {
     private int type;
     @SerializedName("TableNo")
     private int tableNo;
+    @IsURL
     @SerializedName("VideoURL")
-    private String videoURL;
+    private String videoUrl;
     @SerializedName("InitDate")
     private Date initDate;
     @SerializedName("ModDate")
@@ -94,14 +102,21 @@ public class JsonMatch extends JsonIdEntity implements Match {
     private Date endDate;
     @SerializedName("ScheduledDate")
     private Date scheduledDate;
+    @WithHTMLTags
     @SerializedName("FrameScores")
     private String frameScores;
+    @WithHTMLTags
     @SerializedName("Sessions")
     private String sessions;
+    @WithHTMLTags
     @SerializedName("Note")
-    private String  note;
+    private String note;
+    @WithHTMLTags
     @SerializedName("ExtendedNote")
-    private String  extendedNote;
+    private String extendedNote;
+
+    JsonMatch() {
+    }
 
     @Override
     public int matchId() {
@@ -249,33 +264,43 @@ public class JsonMatch extends JsonIdEntity implements Match {
     }
 
     @Override
-    public String videoURL() {
-        return videoURL;
+    public String videoUrl() {
+        return videoUrl;
     }
 
     @Override
     public Date initDate() {
-        return initDate;
+        return initDate == null
+                ? null
+                : new Date(initDate.getTime());
     }
 
     @Override
     public Date modDate() {
-        return modDate;
+        return modDate == null
+                ? null
+                : new Date(modDate.getTime());
     }
 
     @Override
     public Date startDate() {
-        return startDate;
+        return startDate == null
+                ? null
+                : new Date(startDate.getTime());
     }
 
     @Override
     public Date endDate() {
-        return endDate;
+        return endDate == null
+                ? null
+                : new Date(endDate.getTime());
     }
 
     @Override
     public Date scheduledDate() {
-        return scheduledDate;
+        return scheduledDate == null
+                ? null
+                : new Date(scheduledDate.getTime());
     }
 
     @Override