[LIB-8] Add EventFormat to the Event entity
[snooker-score-api.git] / src / main / java / org / hedgecode / snooker / json / JsonEvent.java
index 348d1a5..0ba62ab 100644 (file)
@@ -22,6 +22,7 @@ import com.google.gson.annotations.Expose;
 import com.google.gson.annotations.SerializedName;
 
 import org.hedgecode.snooker.api.Event;
+import org.hedgecode.snooker.api.EventFormat;
 import org.hedgecode.snooker.api.Season;
 
 /**
@@ -85,6 +86,8 @@ public class JsonEvent extends JsonIdEntity implements Event {
     private boolean team;
     @SerializedName("Format")
     private int format;
+    @Expose
+    private EventFormat formatType;
     @SerializedName("Twitter")
     private String twitter;
     @SerializedName("HashTag")
@@ -259,6 +262,13 @@ public class JsonEvent extends JsonIdEntity implements Event {
     }
 
     @Override
+    public EventFormat formatType() {
+        if (formatType == null)
+            formatType = EventFormat.byNumber(format);
+        return formatType;
+    }
+
+    @Override
     public String twitter() {
         return twitter;
     }