Package net.thauvin.erik.frankfurter
Class TimeSeries.Builder
java.lang.Object
net.thauvin.erik.frankfurter.TimeSeries.Builder
- Enclosing class:
- TimeSeries
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionamount
(int amount) Sets the amount for the builder.Sets the amount for the builder.Sets the base currency symbol for the builder.build()
Builds and returns a new instance of theTimeSeries
class using the current state of the Builder.Sets the end date for the builder using aLocalDate
object.Sets the start date for the builder using aLocalDate
object.Sets the currency symbols for the builder using a variable number of string arguments.symbols
(Collection<String> symbols) Sets the currency symbols for the builder using a collection of string arguments.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
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
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
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
Builds and returns a new instance of theTimeSeries
class using the current state of the Builder.- Returns:
- A new
TimeSeries
instance configured according to the properties set in the Builder
-
endDate
Sets the end date for the builder using aLocalDate
object. The provided date must be on or after January 4, 1994.- Parameters:
endDate
- theLocalDate
object representing the end date to be set- Returns:
- the current
Builder
instance for method chaining - Throws:
DateTimeParseException
- if the providedLocalDate
is invalid or cannot be processedIllegalArgumentException
- if the providedLocalDate
is earlier than January 4, 1994
-
startDate
Sets the start date for the builder using aLocalDate
object. The provided date must not be earlier than January 4, 1994.- Parameters:
startDate
- theLocalDate
object representing the start date to be set- Returns:
- the current
Builder
instance for method chaining - Throws:
DateTimeParseException
- if the providedLocalDate
is invalid or cannot be processedIllegalArgumentException
- if the providedLocalDate
is earlier than January 4, 1994
-
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
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
-