/* * 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. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.hedgecode.snooker.json; import java.io.Serializable; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import org.hedgecode.snooker.api.Event; import org.hedgecode.snooker.api.Player; import org.hedgecode.snooker.api.Seeding; /** * Seeding Entity to JSON deserialize. * * @author Dmitry Samoshin aka gotty */ public class JsonSeeding extends JsonIdEntity implements Seeding, Serializable { private static final long serialVersionUID = -9182126924854384725L; @SerializedName("EventID") private int eventId; @Expose private Event event; @SerializedName("PlayerID") private int playerId; @Expose private Player player; @SerializedName("Seeding") private int seeding; JsonSeeding() { } @Override public int eventId() { return eventId; } @Override public Event event() { return event; } public void setEvent(Event event) { if (event != null && eventId == event.eventId()) this.event = event; } @Override public int playerId() { return playerId; } @Override public Player player() { return player; } public void setPlayer(Player player) { if (player != null && playerId == player.playerId()) this.player = player; } @Override public int seeding() { return seeding; } @Override public int getId() { return seeding; } }