Package net.thauvin.erik.frankfurter
Class TimeSeries.Builder
java.lang.Object
net.thauvin.erik.frankfurter.TimeSeries.Builder
- Enclosing class:
- TimeSeries
Builder class 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 TypeMethodDescription@NotNull TimeSeries.Builderamount(double amount) Sets the amount for the builder.@NotNull TimeSeries.Builderamount(int amount) Sets the amount for the builder.@NotNull TimeSeries.BuilderSets the amount for the builder.@NotNull TimeSeries.BuilderSets the base currency symbol for the builder.@NotNull TimeSeriesbuild()Builds and returns a new instance of theTimeSeriesclass using the current state of the Builder.@NotNull TimeSeries.BuilderSets the end date for the builder using aLocalDateobject.@NotNull TimeSeries.BuilderSets the start date for the builder using aLocalDateobject.@NotNull TimeSeries.BuilderSets the currency symbols for the builder using a variable number of string arguments.@NotNull TimeSeries.Buildersymbols(@NotNull 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- Returns:
- the current
Builderinstance for method chaining
-
amount
Sets the amount for the builder.- Parameters:
amount- the monetary amount to be set- Returns:
- the current
Builderinstance for method chaining
-
amount
Sets the amount for the builder.- Parameters:
amount- the monetary amount to be set- Returns:
- the current
Builderinstance 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
Builderinstance for method chaining - Throws:
IllegalArgumentException- if the provided symbol is not exactly three alphabetical characters
-
build
Builds and returns a new instance of theTimeSeriesclass using the current state of the Builder.- Returns:
- a new
TimeSeriesinstance configured according to the properties set in the Builder
-
endDate
Sets the end date for the builder using aLocalDateobject.The provided date must be on or after January 4, 1994.
- Parameters:
endDate- theLocalDateobject representing the end date to be set- Returns:
- the current
Builderinstance for method chaining - Throws:
DateTimeParseException- if the providedLocalDateis invalid or cannot be processedIllegalArgumentException- if the providedLocalDateis earlier than January 4, 1994
-
startDate
Sets the start date for the builder using aLocalDateobject.The provided date must not be earlier than January 4, 1994.
- Parameters:
startDate- theLocalDateobject representing the start date to be set- Returns:
- the current
Builderinstance for method chaining - Throws:
DateTimeParseException- if the providedLocalDateis invalid or cannot be processedIllegalArgumentException- if the providedLocalDateis 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
Builderinstance 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
Builderinstance for method chaining - Throws:
IllegalArgumentException- if any symbol in the collection is not exactly three alphabetical characters
-