import com.google.gson.annotations.SerializedName;
import org.hedgecode.snooker.api.Event;
+import org.hedgecode.snooker.api.EventFormat;
import org.hedgecode.snooker.api.Season;
/**
private boolean team;
@SerializedName("Format")
private int format;
+ @Expose
+ private EventFormat formatType;
@SerializedName("Twitter")
private String twitter;
@SerializedName("HashTag")
@SerializedName("PreviousEdition")
private int previousEdition;
+ protected JsonEvent() {
+ }
+
@Override
public int eventId() {
return eventId;
@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
}
@Override
+ public EventFormat formatType() {
+ if (formatType == null)
+ formatType = EventFormat.byNumber(format);
+ return formatType;
+ }
+
+ @Override
public String twitter() {
return twitter;
}