Liking cljdoc? Tell your friends :D

io.randomseed.bankster.jsr-354

JSR-354 (javax.money) naming-compatible façade for Bankster.

This namespace is intentionally Clojure-only: it does not implement javax.money.* interfaces. Instead, it provides functions whose names (and arities, after translating receiver->first-arg) mirror the JSR-354 API so that people familiar with JSR-354 can quickly orient themselves in the Bankster world.

Naming:

  • kebab-case vars are the canonical ones,
  • camelCase vars are provided as simple aliases.

Currency resolution policy defaults to Bankster's registry semantics (weight-based canonical selection).

JSR-354 (javax.money) naming-compatible façade for Bankster.

This namespace is intentionally **Clojure-only**: it does not implement
`javax.money.*` interfaces. Instead, it provides functions whose names (and arities,
after translating receiver->first-arg) mirror the JSR-354 API so that people
familiar with JSR-354 can quickly orient themselves in the Bankster world.

Naming:

- kebab-case vars are the canonical ones,
- camelCase vars are provided as simple aliases.

Currency resolution policy defaults to Bankster's registry semantics (weight-based
canonical selection).
raw docstring

absclj

(abs a)

JSR-354-ish: MonetaryAmount.abs().

JSR-354-ish: `MonetaryAmount.abs()`.
sourceraw docstring

addclj

(add a b)

JSR-354-ish: MonetaryAmount.add(MonetaryAmount).

JSR-354-ish: `MonetaryAmount.add(MonetaryAmount)`.
sourceraw docstring

attr-amount-typeclj

Standard MonetaryContext attribute key for amount type.

Standard MonetaryContext attribute key for amount type.
sourceraw docstring

attr-fixed-scaleclj

Standard MonetaryContext attribute key for fixed-scale flag.

Standard MonetaryContext attribute key for fixed-scale flag.
sourceraw docstring

attr-max-scaleclj

Standard MonetaryContext attribute key for max scale.

Standard MonetaryContext attribute key for max scale.
sourceraw docstring

attr-number-typeclj

Standard MonetaryContext attribute key for number type.

Standard MonetaryContext attribute key for number type.
sourceraw docstring

attr-precisionclj

Standard MonetaryContext attribute key for precision.

Standard MonetaryContext attribute key for precision.
sourceraw docstring

compare-toclj

(compare-to a b)

JSR-354-ish: MonetaryAmount.compareTo(MonetaryAmount).

JSR-354-ish: `MonetaryAmount.compareTo(MonetaryAmount)`.
sourceraw docstring

compareToclj

source

contextclj

(context)
(context opts)

Builds a MonetaryContext.

Options (all optional):

  • :amount-type -> Class (default: io.randomseed.bankster.Money)
  • :number-type -> Class (default: java.math.BigDecimal)
  • :precision -> integer/long or nil
  • :max-scale -> integer/long or nil
  • :fixed-scale? -> boolean or nil
  • :attrs -> map (keys normalized to strings; see attr-* vars)

Bankster runtime extras (stored under :bankster in the resulting record):

  • :registry -> io.randomseed.bankster.Registry (or nil)
  • :rounding-mode -> rounding spec accepted by scale/post-parse-rounding
  • :rescale-each? -> boolean
  • :currency-resolution -> keyword (default: :weight)

The builder also standardizes a small set of string keys in attrs: attr-amount-type, attr-number-type, and (when present) attr-precision, attr-max-scale, attr-fixed-scale.

Builds a `MonetaryContext`.

Options (all optional):

- `:amount-type`       -> Class (default: `io.randomseed.bankster.Money`)
- `:number-type`       -> Class (default: `java.math.BigDecimal`)
- `:precision`         -> integer/long or nil
- `:max-scale`         -> integer/long or nil
- `:fixed-scale?`      -> boolean or nil
- `:attrs`             -> map (keys normalized to strings; see `attr-*` vars)

Bankster runtime extras (stored under `:bankster` in the resulting record):

- `:registry`          -> `io.randomseed.bankster.Registry` (or nil)
- `:rounding-mode`     -> rounding spec accepted by `scale/post-parse-rounding`
- `:rescale-each?`     -> boolean
- `:currency-resolution` -> keyword (default: `:weight`)

The builder also standardizes a small set of string keys in `attrs`:
`attr-amount-type`, `attr-number-type`, and (when present) `attr-precision`,
`attr-max-scale`, `attr-fixed-scale`.
sourceraw docstring

createclj

JSR-354-ish: MonetaryAmountFactory-like constructor.

Delegates to io.randomseed.bankster.money/value (Accountable).

JSR-354-ish: MonetaryAmountFactory-like constructor.

Delegates to `io.randomseed.bankster.money/value` (Accountable).
sourceraw docstring

divideclj

(divide a divisor)
(divide a divisor rounding-mode)

JSR-354-ish: MonetaryAmount.divide(Number) and MonetaryAmount.divide(Number, RoundingMode).

JSR-354-ish: `MonetaryAmount.divide(Number)` and `MonetaryAmount.divide(Number, RoundingMode)`.
sourceraw docstring

get-currenciesclj

(get-currencies)

JSR-354-ish: Monetary.getCurrencies().

Returns a set of currencies known to the default registry.

JSR-354-ish: `Monetary.getCurrencies()`.

Returns a set of currencies known to the default registry.
sourceraw docstring

get-currencyclj

(get-currency currency-or-money)

JSR-354-ish: Monetary.getCurrency(String) and MonetaryAmount.getCurrency().

Returns a Bankster Currency resolved in the default registry (weight-based).

JSR-354-ish: `Monetary.getCurrency(String)` and `MonetaryAmount.getCurrency()`.

Returns a Bankster `Currency` resolved in the default registry (weight-based).
sourceraw docstring

get-currency-codeclj

(get-currency-code currency-or-money)

JSR-354-ish: CurrencyUnit.getCurrencyCode().

JSR-354-ish: `CurrencyUnit.getCurrencyCode()`.
sourceraw docstring

get-default-fraction-digitsclj

(get-default-fraction-digits currency-or-money)

JSR-354-ish: CurrencyUnit.getDefaultFractionDigits().

Returns Bankster's currency scale (decimal places) or -1 for auto-scaled.

JSR-354-ish: `CurrencyUnit.getDefaultFractionDigits()`.

Returns Bankster's currency scale (decimal places) or `-1` for auto-scaled.
sourceraw docstring

get-default-roundingclj

(get-default-rounding)

JSR-354-ish: Monetary.getDefaultRounding().

Returns a MonetaryOperator-like function (Money -> Money) that rescales a money amount to its currency's nominal scale.

Uses io.randomseed.bankster.scale/*rounding-mode* when bound, otherwise defaults to io.randomseed.bankster.scale/ROUND_HALF_EVEN.

JSR-354-ish: `Monetary.getDefaultRounding()`.

Returns a MonetaryOperator-like function `(Money -> Money)` that rescales a money
amount to its currency's nominal scale.

Uses `io.randomseed.bankster.scale/*rounding-mode*` when bound, otherwise defaults
to `io.randomseed.bankster.scale/ROUND_HALF_EVEN`.
sourceraw docstring

get-numberclj

(get-number money)

JSR-354-ish: MonetaryAmount.getNumber().

Returns the money amount as java.math.BigDecimal.

JSR-354-ish: `MonetaryAmount.getNumber()`.

Returns the money amount as `java.math.BigDecimal`.
sourceraw docstring

get-number-strippedclj

(get-number-stripped money)

JSR-354-ish: MonetaryAmount.getNumberStripped().

Returns the money amount with trailing zeros stripped.

JSR-354-ish: `MonetaryAmount.getNumberStripped()`.

Returns the money amount with trailing zeros stripped.
sourceraw docstring

get-numeric-codeclj

(get-numeric-code currency-or-money)

JSR-354-ish: CurrencyUnit.getNumericCode().

Returns Bankster's numeric-id (ISO 4217) or -1 when missing.

JSR-354-ish: `CurrencyUnit.getNumericCode()`.

Returns Bankster's numeric-id (ISO 4217) or `-1` when missing.
sourceraw docstring

getCurrenciesclj

source

getCurrencyclj

source

getCurrencyCodeclj

source

getDefaultFractionDigitsclj

source

getDefaultRoundingclj

source

getNumberclj

source

getNumberStrippedclj

source

getNumericCodeclj

source

is-equal-toclj

(is-equal-to a b)

JSR-354-ish: MonetaryAmount.isEqualTo(MonetaryAmount).

Scale-insensitive comparison of amounts (currency must match).

JSR-354-ish: `MonetaryAmount.isEqualTo(MonetaryAmount)`.

Scale-insensitive comparison of amounts (currency must match).
sourceraw docstring

is-greater-thanclj

(is-greater-than a b)

JSR-354-ish: MonetaryAmount.isGreaterThan(MonetaryAmount).

JSR-354-ish: `MonetaryAmount.isGreaterThan(MonetaryAmount)`.
sourceraw docstring

is-greater-than-or-equal-toclj

(is-greater-than-or-equal-to a b)

JSR-354-ish: MonetaryAmount.isGreaterThanOrEqualTo(MonetaryAmount).

JSR-354-ish: `MonetaryAmount.isGreaterThanOrEqualTo(MonetaryAmount)`.
sourceraw docstring

is-less-thanclj

(is-less-than a b)

JSR-354-ish: MonetaryAmount.isLessThan(MonetaryAmount).

JSR-354-ish: `MonetaryAmount.isLessThan(MonetaryAmount)`.
sourceraw docstring

is-less-than-or-equal-toclj

(is-less-than-or-equal-to a b)

JSR-354-ish: MonetaryAmount.isLessThanOrEqualTo(MonetaryAmount).

JSR-354-ish: `MonetaryAmount.isLessThanOrEqualTo(MonetaryAmount)`.
sourceraw docstring

is-negativeclj

(is-negative a)

JSR-354-ish: MonetaryAmount.isNegative().

JSR-354-ish: `MonetaryAmount.isNegative()`.
sourceraw docstring

is-negative-or-zeroclj

(is-negative-or-zero a)

JSR-354-ish: MonetaryAmount.isNegativeOrZero().

JSR-354-ish: `MonetaryAmount.isNegativeOrZero()`.
sourceraw docstring

is-positiveclj

(is-positive a)

JSR-354-ish: MonetaryAmount.isPositive().

JSR-354-ish: `MonetaryAmount.isPositive()`.
sourceraw docstring

is-positive-or-zeroclj

(is-positive-or-zero a)

JSR-354-ish: MonetaryAmount.isPositiveOrZero().

JSR-354-ish: `MonetaryAmount.isPositiveOrZero()`.
sourceraw docstring

is-zeroclj

(is-zero a)

JSR-354-ish: MonetaryAmount.isZero().

JSR-354-ish: `MonetaryAmount.isZero()`.
sourceraw docstring

isEqualToclj

source

isGreaterThanclj

source

isGreaterThanOrEqualToclj

source

isLessThanclj

source

isLessThanOrEqualToclj

source

isNegativeclj

source

isNegativeOrZeroclj

source

isPositiveclj

source

isPositiveOrZeroclj

source

isZeroclj

source

multiplyclj

(multiply a multiplicand)

JSR-354-ish: MonetaryAmount.multiply(Number).

JSR-354-ish: `MonetaryAmount.multiply(Number)`.
sourceraw docstring

negateclj

(negate a)

JSR-354-ish: MonetaryAmount.negate().

JSR-354-ish: `MonetaryAmount.negate()`.
sourceraw docstring

plusclj

(plus a)

JSR-354-ish: MonetaryAmount.plus().

JSR-354-ish: `MonetaryAmount.plus()`.
sourceraw docstring

queryclj

(query amount monetary-query)

JSR-354-ish: MonetaryAmount.query(MonetaryQuery).

In Clojure, a MonetaryQuery is just a function (Money -> any).

JSR-354-ish: `MonetaryAmount.query(MonetaryQuery)`.

In Clojure, a MonetaryQuery is just a function `(Money -> any)`.
sourceraw docstring

remainderclj

(remainder a divisor)
(remainder a divisor rounding-mode)

JSR-354-ish: MonetaryAmount.remainder(Number) and MonetaryAmount.remainder(Number, RoundingMode).

JSR-354-ish: `MonetaryAmount.remainder(Number)` and `MonetaryAmount.remainder(Number, RoundingMode)`.
sourceraw docstring

signumclj

(signum a)

JSR-354-ish: MonetaryAmount.signum().

JSR-354-ish: `MonetaryAmount.signum()`.
sourceraw docstring

strip-trailing-zerosclj

(strip-trailing-zeros a)

JSR-354-ish: MonetaryAmount.stripTrailingZeros().

JSR-354-ish: `MonetaryAmount.stripTrailingZeros()`.
sourceraw docstring

stripTrailingZerosclj

source

subtractclj

(subtract a b)

JSR-354-ish: MonetaryAmount.subtract(MonetaryAmount).

JSR-354-ish: `MonetaryAmount.subtract(MonetaryAmount)`.
sourceraw docstring

withclj

(with amount operator)

JSR-354-ish: MonetaryAmount.with(MonetaryOperator).

In Clojure, a MonetaryOperator is just a function (Money -> Money).

JSR-354-ish: `MonetaryAmount.with(MonetaryOperator)`.

In Clojure, a MonetaryOperator is just a function `(Money -> Money)`.
sourceraw docstring

with-contextcljmacro

(with-context ctx & body)

Applies a JSR-354-style context in a lexical scope.

In this Clojure-only compat layer, we interpret the context as inputs to dynamic Bankster runtime settings (registry and scaling/rounding), not as mutable state.

Uses (:bankster ctx) as an optional map of settings. Supported keys:

  • :registry -> io.randomseed.bankster.Registry (binds registry/*default*)
  • :rounding-mode -> java.math.RoundingMode or a value accepted by io.randomseed.bankster.scale/post-parse-rounding (binds scale/*rounding-mode*)
  • :rescale-each? -> boolean (binds scale/*each*)

Unspecified keys do not override current bindings. Keys may be present with nil values to explicitly clear a binding (e.g. set rounding-mode to nil).

Applies a JSR-354-style context in a lexical scope.

In this Clojure-only compat layer, we interpret the context as *inputs to dynamic
Bankster runtime settings* (registry and scaling/rounding), not as mutable state.

Uses `(:bankster ctx)` as an optional map of settings.
Supported keys:

- `:registry`       -> `io.randomseed.bankster.Registry` (binds `registry/*default*`)
- `:rounding-mode`  -> `java.math.RoundingMode` or a value accepted by
                      `io.randomseed.bankster.scale/post-parse-rounding`
                      (binds `scale/*rounding-mode*`)
- `:rescale-each?`  -> boolean (binds `scale/*each*`)

Unspecified keys do not override current bindings. Keys may be present with `nil`
values to explicitly clear a binding (e.g. set rounding-mode to nil).
sourceraw docstring

withContextcljmacro

(withContext ctx & body)

Alias for with-context.

Alias for `with-context`.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close