Class LatestRates

java.lang.Object
net.thauvin.erik.frankfurter.LatestRates

public class LatestRates extends Object
Represents the latest exchange rates based on a specific base currency, date, and symbols.
  • Constructor Details

    • LatestRates

      public LatestRates(LatestRates.Builder builder)
      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

      public Double getAmount()
      Retrieves the amount of the latest exchange rate or time series.
      Returns:
      A Double representing the amount
    • getBase

      public String getBase()
      Retrieves the base currency for the current rates or time series.
      Returns:
      A string representing the base currency
    • getDate

      public LocalDate 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 a ExchangeRates 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 handling
      URISyntaxException - if the URI syntax is invalid
      JsonSyntaxException - if the JSON response from the API does not match the expected format
    • getSymbols

      public Collection<String> getSymbols()
      Retrieves the collection of currency symbols associated with the rates.
      Returns:
      A collection of strings representing the currency symbols