Class CurrencyConverters.Chain

java.lang.Object
com.eqixiac.equinix.design.cost.CurrencyConverters.Chain
All Implemented Interfaces:
CurrencyConverter
Enclosing class:
CurrencyConverters

public static final class CurrencyConverters.Chain extends Object implements CurrencyConverter
First-answer-wins composition that can report fallbacks.
  • Method Details

    • rate

      public Optional<CurrencyConverter.Rate> rate(String from, String to)
      Specified by:
      rate in interface CurrencyConverter
      Parameters:
      from - ISO 4217 code
      to - ISO 4217 code
      Returns:
      the rate, or empty when this converter has none for the pair
    • name

      public String name()
      Specified by:
      name in interface CurrencyConverter
      Returns:
      a short name for reasons and diagnostics
    • notes

      public List<String> notes()
      Returns:
      notes from sources that fell back (e.g. the live call failed)
    • missingReason

      public String missingReason(String from, String to)
      Parameters:
      from - ISO 4217 code
      to - ISO 4217 code
      Returns:
      the reason no source converts the pair