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

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

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

import java.util.Objects;
import java.util.TimeZone;

/**
 * A stadium or ground where a match is played.
 * 

Use {@link #venue()} to create a builder.

*/ public class Venue { private final String name; private final String city; private final String territory; private final TimeZone timeZone; protected Venue(Builder builder) { this.name = Objects.requireNonNull(builder.name); this.city = builder.city; this.territory = builder.territory; this.timeZone = Objects.requireNonNull(builder.timeZone); } /** * @return The name of the venue, such as "Eden Park" */ public String name() { return name; } /** * @return The city (or town) that this venue is in. */ public String city() { return city; } /** * @return The country or territory that the venue is in */ public String territory() { return territory; } /** * @return The timezone at the venue. */ public TimeZone timeZone() { return timeZone; } /** * @return A new venue builder. */ public static Builder venue() { return new Builder(); } public static class Builder { private String name; private String city; private String territory; private TimeZone timeZone; /** * @param name The name of the venue, such as "Eden Park" * @return This builder */ public Builder withName(String name) { this.name = name; return this; } /** * @param city The city (or town) that this venue is in, such as "Auckland" * @return This builder */ public Builder withCity(String city) { this.city = city; return this; } /** * @param territory The country or territory that the venue is in, such as * @return This builder */ public Builder withTerritory(String territory) { this.territory = territory; return this; } /** * @param timeZone The timezone at the venue, for example TimeZone.getTimeZone("Pacific/Auckland") * @return This builder */ public Builder withTimeZone(TimeZone timeZone) { this.timeZone = timeZone; return this; } /** * @return A venue */ public Venue build() { return new Venue(this); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy