Reputation: 5062
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
Upvotes: 3
Views: 208
Reputation: 144126
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"))
Upvotes: 5