Package net.thauvin.erik.frankfurter
Class LatestRates
java.lang.Object
net.thauvin.erik.frankfurter.LatestRates
Represents the latest exchange rates based on a specific base currency, date, and symbols.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder class to create and configure an instance ofLatestRates
. -
Constructor Summary
ConstructorsConstructorDescriptionLatestRates
(LatestRates.Builder builder) Constructs a new LatestRates instance using the specified Builder. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the amount of the latest exchange rate or time series.getBase()
Retrieves the base currency for the current rates or time series.getDate()
Retrieves the date associated with the latest exchange rates.Retrieves the latest exchange rates based on a specified base currency, date, and optional symbols.Retrieves the collection of currency symbols associated with the rates.
-
Constructor Details
-
LatestRates
Constructs a new LatestRates instance using the specified Builder.- Parameters:
builder
- The Builder instance containing the base currency, date, and symbols to initialize the LatestRates object.
-
-
Method Details
-
getAmount
Retrieves the amount of the latest exchange rate or time series.- Returns:
- A
Double
representing the amount
-
getBase
Retrieves the base currency for the current rates or time series.- Returns:
- A string representing the base currency
-
getDate
Retrieves the date associated with the latest exchange rates.- Returns:
- A
LocalDate
representing the date
-
getExchangeRates
Retrieves the latest exchange rates based on a specified base currency, date, and optional symbols. This method constructs a request to the Frankfurter API, fetches the data, and parses the response into aExchangeRates
object.- Returns:
- an instance of
ExchangeRates
containing the base currency, date, and exchange rates - Throws:
IOException
- if an error occurs during the API request or response handlingURISyntaxException
- if the URI syntax is invalidJsonSyntaxException
- if the JSON response from the API does not match the expected format
-
getSymbols
Retrieves the collection of currency symbols associated with the rates.- Returns:
- A collection of strings representing the currency symbols
-