All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.danielflower.crickam.scorer.Team Maven / Gradle / Ivy

There is a newer version: 0.11.3
Show newest version
package com.danielflower.crickam.scorer;

import static java.util.Objects.requireNonNull;

/**
 * A cricket team
 * 

Note that when a team plays in a match, the actual batting order is specified with the {@link LineUp} class.

*

Use {@link #team()} to get a {@link Builder} to create a team.

*

This class is designed to be inherited if you wish to add custom data to the model.

*/ public class Team { private final String shortName; private final String name; protected Team(Builder builder) { this.name = requireNonNull(builder.name); this.shortName = requireNonNull(builder.shortName); } public String name() { return name; } /** * @return An abbreviation of the team, such as "NZL" */ public String shortName() { return shortName; } public String toString() { return name; } public static Builder team() { return new Builder(); } public static class Builder { private String name; private String shortName; public Builder withName(String name) { this.name = name; return this; } /** * @param shortName An abbreviation of the team, such as "NZL" * @return This builder */ public Builder withShortName(String shortName) { this.shortName = shortName; return this; } public Team build() { return new Team(this); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy