Class TimeSeries.Builder

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

public static class TimeSeries.Builder extends Object
The Builder class provides a flexible way 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

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

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

      public TimeSeries.Builder base(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

      public 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

      public TimeSeries.Builder endDate(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

      public TimeSeries.Builder startDate(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

      public TimeSeries.Builder symbols(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

      public TimeSeries.Builder symbols(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