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.
- Since:
- 0.9.0
- Author:
- Erik C. Thauvin
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class to construct instances of theLatestRatesclass. -
Constructor Summary
ConstructorsConstructorDescriptionLatestRates(LatestRates.Builder builder) Constructs a newLatestRatesinstance using the specified Builder. -
Method Summary
Modifier and TypeMethodDescriptionamount()Retrieves the amount of the latest exchange rate or time series.base()Retrieves the base currency for the current rates or time series.date()Retrieves the date associated with the latest exchange rates.Retrieves the latest exchange rates based on a specified base currency, date, and optional symbols.symbols()Retrieves the list of currency symbols associated with the rates.
-
Constructor Details
-
LatestRates
Constructs a newLatestRatesinstance using the specified Builder.- Parameters:
builder- the Builder instance containing the base currency, date, and symbols to initialize theLatestRatesobject
-
-
Method Details
-
amount
Retrieves the amount of the latest exchange rate or time series.- Returns:
- a
Doublerepresenting the amount
-
base
Retrieves the base currency for the current rates or time series.- Returns:
- a string representing the base currency
-
date
Retrieves the date associated with the latest exchange rates.- Returns:
- a
LocalDaterepresenting the date
-
exchangeRates
public ExchangeRates exchangeRates() throws IOException, URISyntaxException, JsonSyntaxException, InterruptedExceptionRetrieves 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 a
ExchangeRatesobject.- Returns:
- an instance of
ExchangeRatescontaining 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 formatInterruptedException
-
symbols
Retrieves the list of currency symbols associated with the rates.- Returns:
- a list of strings representing the currency symbols
-