Class CheckerCurrency
- All Implemented Interfaces:
InterfaceChecker<AbstractChecker<Currency,
CheckerCurrency>, Currency>
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.
-
Field Summary
Fields inherited from class util.AbstractChecker
backObject, exceptionTracker, name, object, saveErrors, stop
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CheckerCurrency
(Currency currency, String name) Constructs a newCheckerCurrency
with the specified currency and name. -
Method Summary
Modifier and TypeMethodDescriptionstatic CheckerCurrency
Creates a new CheckerCurrency instance for the given currency with a default name.static CheckerCurrency
Creates a new CheckerCurrency instance for the given currency and name.Checks if the currency has the specified symbol in the default locale.Checks if the currency has the specified symbol in the given locale.Checks if the currency is the one used in the specified locale.protected CheckerCurrency
self()
Returns this instance (for fluent API usage).withDefaultFractionDigits
(int n) Checks if the currency has the specified number of default fraction digits.Methods inherited from class util.AbstractChecker
checkProperty, checkProperty, checkProperty, end, getMethod, getObject, getProperty, hasErrors, hasNotErrors, is, is, isEqual, isNonNull, isNot, isNot, isNull, notSaveErrors, saveErrors, show, showNotThrownException, showThrownException, stop
-
Constructor Details
-
CheckerCurrency
-
-
Method Details
-
check
Creates a new CheckerCurrency instance for the given currency and name.- Parameters:
currency
- the currency value to be checkedname
- the name to identify the currency in error messages- Returns:
- a CheckerCurrency instance for further validations
-
check
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
Returns this instance (for fluent API usage).- Specified by:
self
in classAbstractChecker<Currency,
CheckerCurrency> - Returns:
- this CheckerCurrency instance
-
hasSymbol
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
Checks if the currency has the specified symbol in the given locale.- Parameters:
symbol
- the symbol to compare with the currency's symbollocale
- the locale to use for symbol lookup- Returns:
- this CheckerCurrency instance for chaining
-
withDefaultFractionDigits
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
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
-