I have seen this somewhere documented but I cannot remember where and what was the name of the function: what I am searching for is a function/macro that takes (a Java) object as an argument, executes a sequence of methods on that object and returns it. Something like that:
(<the function> obj
(.setName obj "the name")
(.setAmount obj42.0)
; ...
(.setDescription obj "the description")) ; returns the updated obj
You can use ..:
(.. obj (setName "the name") (setAmount 42.0) ... (setDescription "the description"))
If the methods do not return the target object you can use doto:
(doto obj (.setName "the name") (.setAmount 42.0) ... (.setDescription "the description"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With