Utilities to help Java interop with MongoDB Java driver
Utilities to help Java interop with MongoDB Java driver
(apply-builder target-type setters options)
If options
is already an instance of target-type
, returns options
. Otherwise
creates an instance of target-type
builder (assumes that the target-type
has a
static function builder
for that purpose). Then applies reduce-with-setters
with
builder, setters
and options
. Returns an instance create by calling method build
of builder.
If `options` is already an instance of `target-type`, returns `options`. Otherwise creates an instance of `target-type` builder (assumes that the `target-type` has a static function `builder` for that purpose). Then applies `reduce-with-setters` with builder, `setters` and `options`. Returns an instance create by calling method `build` of builder.
(apply-setters target-type setters options)
If options
is already an instance of target-type
, returns options
. Otherwise
creates an instance of target-type
and applies reduce-with-setters
with that instance,
setters
and options
. Returns the created instance.
If `options` is already an instance of `target-type`, returns `options`. Otherwise creates an instance of `target-type` and applies `reduce-with-setters` with that instance, `setters` and `options`. Returns the created instance.
(cast! type value options)
Convert value
to instance of type
using fixed set of options If the value
is
already instance of type
, the value
is returned, otherwise the options
is
expected to contain a mapping from value
to instance. If mapping is not available
throws an exception.
Convert `value` to instance of `type` using fixed set of options If the `value` is already instance of `type`, the `value` is returned, otherwise the `options` is expected to contain a mapping from `value` to instance. If mapping is not available throws an exception.
(reduce-with-setters target setters options)
Given the target object, a mapping from keys to setter functions, and a map
of options, calls setters with target and value. Takes each key/value from options
,
gets a setter from setters
using the key
(if not found throws an exception), then
invokes the setter with the target
and value
. Returns target.
Given the target object, a mapping from keys to setter functions, and a map of options, calls setters with target and value. Takes each key/value from `options`, gets a setter from `setters` using the `key` (if not found throws an exception), then invokes the setter with the `target` and `value`. Returns target.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close