Record Class Currency

java.lang.Object
java.lang.Record
net.thauvin.erik.frankfurter.models.Currency
All Implemented Interfaces:
CurrencyResult

public record Currency(String isoCode, String isoNumeric, String name, String symbol, LocalDate startDate, LocalDate endDate) extends Record implements CurrencyResult
Represents a currency entry returned by the Frankfurter /currencies endpoint.

The API provides metadata for each currency, including its ISO codes, display name, symbol, and the date range for which data is available.

All fields except isoCode and name may be null depending on the currency and the data available from the API.

Values are stored exactly as returned by the API. No normalization is performed, as the API is considered authoritative. Validation only ensures non-null/blank for fields required to identify a currency.

Since:
1.0
Author:
Erik C. Thauvin
  • Constructor Details

    • Currency

      public Currency(String isoCode, @Nullable String isoNumeric, String name, @Nullable String symbol, @Nullable LocalDate startDate, @Nullable LocalDate endDate)
      Creates a new currency entry.
      Parameters:
      isoCode - the ISO 4217 alphabetic currency code
      isoNumeric - the ISO 4217 numeric currency code, or null
      name - the currency name
      symbol - the currency symbol, or null
      startDate - the first date for which data is available, or null
      endDate - the last date for which data is available, or null
      Throws:
      IllegalArgumentException - if isoCode or name are blank
      NullPointerException - if isoCode or name are null
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • isoCode

      @SerializedName("iso_code") public String isoCode()
      Returns the value of the isoCode record component.
      Returns:
      the value of the isoCode record component
    • isoNumeric

      @SerializedName("iso_numeric") @Nullable public String isoNumeric()
      Returns the value of the isoNumeric record component.
      Returns:
      the value of the isoNumeric record component
    • name

      @SerializedName("name") public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • symbol

      @SerializedName("symbol") @Nullable public String symbol()
      Returns the value of the symbol record component.
      Returns:
      the value of the symbol record component
    • startDate

      @SerializedName("start_date") @Nullable public LocalDate startDate()
      Returns the value of the startDate record component.
      Returns:
      the value of the startDate record component
    • endDate

      @SerializedName("end_date") @Nullable public LocalDate endDate()
      Returns the value of the endDate record component.
      Returns:
      the value of the endDate record component