Class TimeSeries.Builder

java.lang.Object
net.thauvin.erik.frankfurter.TimeSeries.Builder
Enclosing class:
TimeSeries

public static class TimeSeries.Builder extends Object
Builder class to construct instances of the TimeSeries class.

This class allows incremental configuration of the TimeSeries object via method chaining.

  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • amount

      @NotNull public @NotNull TimeSeries.Builder amount(@NotNull @NotNull Double amount)
      Sets the amount for the builder.
      Parameters:
      amount - the monetary amount to be set
      Returns:
      the current Builder instance for method chaining
    • amount

      @NotNull public @NotNull TimeSeries.Builder amount(int amount)
      Sets the amount for the builder.
      Parameters:
      amount - the monetary amount to be set
      Returns:
      the current Builder instance for method chaining
    • amount

      @NotNull public @NotNull TimeSeries.Builder amount(double amount)
      Sets the amount for the builder.
      Parameters:
      amount - the monetary amount to be set
      Returns:
      the current Builder instance for method chaining
    • base

      @NotNull public @NotNull TimeSeries.Builder base(@NotNull @NotNull String base)
      Sets the base currency symbol for the builder.

      The provided symbol will be formatted to uppercase if it is a valid 3-letter currency symbol.

      Parameters:
      base - the base currency symbol to be set; must consist of exactly three alphabetical characters
      Returns:
      the current Builder instance for method chaining
      Throws:
      IllegalArgumentException - if the provided symbol is not exactly three alphabetical characters
    • build

      @NotNull public @NotNull TimeSeries build()
      Builds and returns a new instance of the TimeSeries class using the current state of the Builder.
      Returns:
      a new TimeSeries instance configured according to the properties set in the Builder
    • endDate

      @NotNull public @NotNull TimeSeries.Builder endDate(@NotNull @NotNull LocalDate endDate)
      Sets the end date for the builder using a LocalDate object.

      The provided date must be on or after January 4, 1994.

      Parameters:
      endDate - the LocalDate object representing the end date to be set
      Returns:
      the current Builder instance for method chaining
      Throws:
      DateTimeParseException - if the provided LocalDate is invalid or cannot be processed
      IllegalArgumentException - if the provided LocalDate is earlier than January 4, 1994
    • startDate

      @NotNull public @NotNull TimeSeries.Builder startDate(@NotNull @NotNull LocalDate startDate)
      Sets the start date for the builder using a LocalDate object.

      The provided date must not be earlier than January 4, 1994.

      Parameters:
      startDate - the LocalDate object representing the start date to be set
      Returns:
      the current Builder instance for method chaining
      Throws:
      DateTimeParseException - if the provided LocalDate is invalid or cannot be processed
      IllegalArgumentException - if the provided LocalDate is earlier than January 4, 1994
    • symbols

      @NotNull public @NotNull TimeSeries.Builder symbols(@NotNull @NotNull String... symbols)
      Sets the currency symbols for the builder using a variable number of string arguments.

      Each provided symbol will be formatted and added to the builder's symbols collection.

      Parameters:
      symbols - an array of strings representing currency symbols to be added
      Returns:
      the current Builder instance for method chaining
    • symbols

      @NotNull public @NotNull TimeSeries.Builder symbols(@NotNull @NotNull Collection<String> symbols)
      Sets the currency symbols for the builder using a collection of string arguments.

      Each provided symbol will be formatted to uppercase and added to the builder's symbols collection.

      Parameters:
      symbols - a collection of strings representing currency symbols to be added
      Returns:
      the current Builder instance for method chaining
      Throws:
      IllegalArgumentException - if any symbol in the collection is not exactly three alphabetical characters