Package net.thauvin.erik.frankfurter
Class TimeSeries
java.lang.Object
net.thauvin.erik.frankfurter.TimeSeries
Represents a time series of currency exchange rate data for a specified base currency over a defined date range.
This class provides functionality to retrieve historical exchange rates using a builder pattern for flexible configuration of parameters.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
The Builder class provides a flexible way to construct instances of the TimeSeries class. -
Constructor Summary
ConstructorsConstructorDescriptionTimeSeries
(TimeSeries.Builder builder) Constructs a new instance of the TimeSeries class using the specified builder object. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the amount associated with the current time series.getBase()
Retrieves the base currency for the current time series.Retrieves the end date associated with the time series.Retrieves the periodic exchange rates for a time series based on the specified input parameters.Retrieves the start date associated with the time series.Retrieves the collection of currency symbols associated with the time series.
-
Constructor Details
-
TimeSeries
Constructs a new instance of the TimeSeries class using the specified builder object.- Parameters:
builder
- The Builder instance containing the configuration for the TimeSeries object
-
-
Method Details
-
getAmount
Retrieves the amount associated with the current time series.- Returns:
- A
Double
representing the value of the amount field
-
getBase
Retrieves the base currency for the current time series.- Returns:
- A string representing the base currency
-
getEndDate
Retrieves the end date associated with the time series.- Returns:
- The end date as a
LocalDate
object
-
getPeriodicRates
Retrieves the periodic exchange rates for a time series based on the specified input parameters.This method constructs a time series request using defined start and end dates, base currency, symbols, and amount, and fetches the corresponding data.
- Returns:
- A
SeriesRates
object containing the exchange rate information for the specified time range and conditions. - Throws:
IOException
- If an I/O error occurs during data retrievalURISyntaxException
- If the generated URI for the data request is invalidIllegalArgumentException
- If required parameters such as the start date are not set, or if the end date is before the start dateJsonSyntaxException
- If the JSON response from the API does not match the expected format
-
getStartDate
Retrieves the start date associated with the time series.- Returns:
- The start date as a
LocalDate
object
-
getSymbols
Retrieves the collection of currency symbols associated with the time series.- Returns:
- A collection containing the currency symbols
-