Class Providers

java.lang.Object
net.thauvin.erik.frankfurter.models.Providers
All Implemented Interfaces:
ProvidersResult

@NullMarked public final class Providers extends Object implements ProvidersResult
Represents the set of providers returned by the Frankfurter /providers endpoint.

The API returns a JSON array of provider entries. This type normalizes the structure into a list and provides simple lookup helpers.

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

    • Providers

      public Providers(Collection<Provider> list)
      Creates a new immutable container for the given list of providers.
      Parameters:
      list - the list of provider entries
  • Method Details

    • fromJson

      public static Providers fromJson(String json)
      Parses a JSON array of provider entries into a Providers instance.
      Parameters:
      json - the JSON response
      Returns:
      the parsed providers
    • find

      public Optional<Provider> find(String key)
      Finds a provider by its key.
      Parameters:
      key - the provider key
      Returns:
      an optional containing the matching provider
    • isEmpty

      public boolean isEmpty()
      Returns true if there are no providers in the list.
      Returns:
      true if the list is empty, false otherwise
    • list

      public List<Provider> list()
      Returns all provider entries.
      Returns:
      the list of providers
    • searchByName

      public List<Provider> searchByName(String name)
      Searches providers by name substring.
      Parameters:
      name - the substring to match
      Returns:
      the list of matching providers
    • size

      public int size()
      Returns the number of provider entries.
      Returns:
      the number of entries