Class RateConfig.Builder
java.lang.Object
net.thauvin.erik.frankfurter.config.RateConfig.Builder
- Enclosing class:
- RateConfig
Builder for
RateConfig.
All setter methods return this for method chaining. Call build()
to create the immutable configuration.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSets the base currency.base(CurrencyCode base) Sets the base currency.build()Builds the configuration.Sets an optional historical date.Sets optional provider filters.Sets the quote currency.quote(CurrencyCode quote) Sets the quote currency.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
base
Sets the base currency. Optional.If not set, the Frankfurter API defaults to
EUR.- Parameters:
base- the base currency- Returns:
- this builder
- Throws:
NullPointerException- ifbaseisnull
-
base
Sets the base currency. Optional.If not set, the Frankfurter API defaults to
EUR.- Parameters:
base- 3-letter ISO 4217 currency code, e.g. "USD"- Returns:
- this builder
- Throws:
NullPointerException- ifbaseisnullIllegalArgumentException- if blank or not 3 letters
-
build
Builds the configuration.- Returns:
- the immutable config
- Throws:
IllegalStateException- if quote currency not setIllegalArgumentException- if base and quote are the same
-
date
Sets an optional historical date.- Parameters:
date- the date to query, must not be before 1994-01-04- Returns:
- this builder
- Throws:
NullPointerException- ifdateisnullIllegalArgumentException- if date is earlier than the minimum supported
-
providers
Sets optional provider filters.Blank entries are ignored. Duplicates are removed. The array is defensively copied.
- Parameters:
providers- provider IDs, e.g. "ECB", "BANXICO"- Returns:
- this builder
- Throws:
NullPointerException- if array or any element isnull
-
quote
Sets the quote currency. Required.- Parameters:
quote- the quote currency- Returns:
- this builder
- Throws:
NullPointerException- ifquoteisnull
-
quote
Sets the quote currency. Required.- Parameters:
quote- 3-letter ISO 4217 currency code, e.g. "EUR"- Returns:
- this builder
- Throws:
NullPointerException- ifquoteisnullIllegalArgumentException- if blank or not 3 letters
-