com.danielflower.crickam.scorer.Series Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cricket-scorer Show documentation
Show all versions of cricket-scorer Show documentation
An immutable java library for keeping score of cricket matches
package com.danielflower.crickam.scorer;
import static java.util.Objects.requireNonNull;
/**
* The series that a match is part of
*/
public final class Series {
private final String id;
private final ImmutableList teams;
private final String name;
private Series(String id, ImmutableList teams, String name) {
this.id = requireNonNull(id);
this.teams = requireNonNull(teams);
this.name = requireNonNull(name);
}
public String id() {
return id;
}
public ImmutableList teams() {
return teams;
}
public String name() {
return name;
}
public static Builder series() {
return new Builder();
}
public static final class Builder {
public String id;
public ImmutableList teams;
public String name;
public Builder withId(String id) {
this.id = id;
return this;
}
public Builder withTeams(ImmutableList teams) {
this.teams = teams;
return this;
}
public Builder withName(String name) {
this.name = name;
return this;
}
public Series build() {
return new Series(id, teams, name);
}
}
}