Class CheckerCurrency
java.lang.Object
com.luchersol.core.util.AbstractChecker<Currency,CheckerCurrency>
com.luchersol.core.specialized_checkers.CheckerCurrency
- All Implemented Interfaces:
InterfaceChecker<AbstractChecker<Currency,CheckerCurrency>, Currency>
A specialized checker for
Currency instances, providing a fluent API
to assert various currency properties such as symbol, fraction digits, and locale association.
Typical usage:
Currency usd = Currency.getInstance("USD");
CheckerCurrency.check(usd)
.hasSymbol("$")
.withDefaultFractionDigits(2)
.isFrom(Locale.US);
This class supports chaining multiple assertions in a fluent style and integrates
with AbstractChecker for generalized validation handling.
- See Also:
-
Field Summary
Fields inherited from class com.luchersol.core.util.AbstractChecker
backObject, exceptionTracker, name, object, saveErrors, stop -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCheckerCurrency(Currency currency, String name) Constructs a newCheckerCurrencywith the specified currency and name. -
Method Summary
Modifier and TypeMethodDescriptionstatic CheckerCurrencyCreates a new CheckerCurrency instance for the given currency with a default name.static CheckerCurrencyCreates 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 CheckerCurrencyself()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 com.luchersol.core.util.AbstractChecker
checkProperty, checkProperty, checkProperty, checkProperty, end, getMethod, getObject, getProperty, hasErrors, hasNotErrors, is, is, is, isEqual, isNonNull, isNot, isNot, isNull, notSaveErrors, saveErrors, setBackObject, setExceptionTracker, setName, setObject, setSaveErrors, setStop, show, showPassedChecks, showThrownException, stop, toChecker, updateChecker
-
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:
selfin 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
-