package design.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import java.util.ArrayList; import java.util.Date; import java.util.List; @JsonTypeName("stroke") public class StrokeLeague extends League { private final List participants; @JsonCreator private StrokeLeague(int id, String name, Date registrationDate, Date startDate, Date endDate, Golfer owner, List participants, List schedule) { super(id, name, registrationDate, startDate, endDate, owner, schedule); this.participants = participants; } public StrokeLeague(String name, Date registrationDate, Date startDate, Date endDate, Golfer owner) { super(name, registrationDate, startDate, endDate, owner); this.participants = new ArrayList<>(); } public boolean addParticipants(Golfer e) { return participants.add(e); } public boolean removeParticipants(Golfer o) { return participants.remove(o); } public Golfer[] getParticipants() { return participants.toArray(Golfer[]::new); } }