Class CheckerCurrency

java.lang.Object
util.AbstractChecker<Currency,CheckerCurrency>
specialized_checkers.CheckerCurrency
All Implemented Interfaces:
InterfaceChecker<AbstractChecker<Currency,CheckerCurrency>,Currency>

public class CheckerCurrency extends AbstractChecker<Currency,CheckerCurrency>
CheckerCurrency is a specialized checker for validating and performing assertions on Currency values.

It provides a fluent API for common currency validations such as checking symbols, fraction digits, and locale association.

  • Constructor Details

    • CheckerCurrency

      protected CheckerCurrency(Currency currency, String name)
      Constructs a new CheckerCurrency with the specified currency and name.
      Parameters:
      currency - the Currency to be associated with this checker
      name - the name of the checker
  • Method Details

    • check

      public static CheckerCurrency check(Currency currency, String name)
      Creates a new CheckerCurrency instance for the given currency and name.
      Parameters:
      currency - the currency value to be checked
      name - the name to identify the currency in error messages
      Returns:
      a CheckerCurrency instance for further validations
    • check

      public static CheckerCurrency check(Currency currency)
      Creates a new CheckerCurrency instance for the given currency with a default name.
      Parameters:
      currency - the currency value to be checked
      Returns:
      a CheckerCurrency instance for further validations
    • self

      protected CheckerCurrency self()
      Returns this instance (for fluent API usage).
      Specified by:
      self in class AbstractChecker<Currency,CheckerCurrency>
      Returns:
      this CheckerCurrency instance
    • hasSymbol

      public CheckerCurrency hasSymbol(String symbol)
      Checks if the currency has the specified symbol in the default locale.
      Parameters:
      symbol - the symbol to compare with the currency's symbol
      Returns:
      this CheckerCurrency instance for chaining
    • hasSymbol

      public CheckerCurrency hasSymbol(String symbol, Locale locale)
      Checks if the currency has the specified symbol in the given locale.
      Parameters:
      symbol - the symbol to compare with the currency's symbol
      locale - the locale to use for symbol lookup
      Returns:
      this CheckerCurrency instance for chaining
    • withDefaultFractionDigits

      public CheckerCurrency withDefaultFractionDigits(int n)
      Checks if the currency has the specified number of default fraction digits.
      Parameters:
      n - the expected number of fraction digits
      Returns:
      this CheckerCurrency instance for chaining
    • isFrom

      public CheckerCurrency isFrom(Locale locale)
      Checks if the currency is the one used in the specified locale.
      Parameters:
      locale - the locale to check against
      Returns:
      this CheckerCurrency instance for chaining