我已经在某处记录了这个,但是我不记得函数的名称在哪里和是什么:我正在搜索的是一个函数/宏,它将(一个Java)对象作为参数,在该对象上执行一系列方法归还它。像这样的东西:
(<the function> obj
(.setName obj "the name")
(.setAmount obj42.0)
; ...
(.setDescription obj "the description")) ; returns the updated obj
你可以使用..
:
(.. obj (setName "the name") (setAmount 42.0) ... (setDescription "the description"))
如果方法不返回目标对象,则可以使用doto
:
(doto obj (.setName "the name") (.setAmount 42.0) ... (.setDescription "the description"))