Record Class Provider

java.lang.Object
java.lang.Record
net.thauvin.erik.frankfurter.models.Provider

@NullMarked public record Provider(String key, String name, @Nullable String description, @Nullable String dataUrl, @Nullable String termsUrl, @Nullable LocalDate startDate, @Nullable LocalDate endDate, List<String> currencies) extends Record
Represents a provider entry returned by the Frankfurter /providers endpoint.

The API supplies metadata for each provider, including its identifier, descriptive information, data source URLs, the date range of available data, and the list of currencies supported by the provider.

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

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

    • Provider

      public Provider(String key, String name, @Nullable String description, @Nullable String dataUrl, @Nullable String termsUrl, @Nullable LocalDate startDate, @Nullable LocalDate endDate, List<String> currencies)
      Creates a new provider entry.
      Parameters:
      key - the provider identifier
      name - the provider name
      description - the provider description, or null
      dataUrl - the data source URL, or null
      termsUrl - the terms-of-use URL, or null
      startDate - the first date for which data is available, or null
      endDate - the last date for which data is available, or null
      currencies - the list of supported currencies
      Throws:
      IllegalArgumentException - if key or name is blank
  • 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.
    • key

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

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

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

      @SerializedName("data_url") public @Nullable String dataUrl()
      Returns the value of the dataUrl record component.
      Returns:
      the value of the dataUrl record component
    • termsUrl

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

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

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

      @SerializedName("currencies") public List<String> currencies()
      Returns the value of the currencies record component.
      Returns:
      the value of the currencies record component