Clojure: calling a sequence of methods on a Java object

Michael

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
Lee

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"))

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Calling methods on string literals (Java)

From Java

Calling clojure from java

From Java

How do turn a java Iterator-like object into a clojure sequence

From Java

calling java methods in javascript code

From Java

Calling java functions from Clojure

From Java

Calling Java from Clojure

From Java

Make a Java class work as a sequence in Clojure

From Java

Clojure macro for calling Java setters based on a map?

From Java

Problems calling a variadic Java function from Clojure

From Java

Calling multiple methods in Java

From Java

Calling methods of "parent" component in Java

From Java

Calling the methods in a class in Java

From Java

Calling two Java methods asynchronously

From Java

calling clojure from Java (Clojure Interop)

From Java

Calling methods on reference variable vs Calling methods on a new object

From Dev

Java: Calling Object in Method Outside of Main with Static Methods

From Dev

Generics in Java preventing calling of methods

From Dev

Calling Java Methods in XSLT

From Dev

NoClassDefFoundError calling Clojure from Java (Android, LibGDX)

From Dev

Call list of methods on object in sequence, piping the methods?

From Dev

XPages - Calling Java methods

From Dev

Calling methods in a Java Fx ActionEvent

From Dev

Calling methods for my java class

From Dev

Calling the methods in java

From Dev

Calling methods on objects Java

From Dev

Calling Java methods with React locally

From Dev

Calling object methods in Javascript

From Dev

Calling multiple methods of an object in sequence

From Dev

Test of the sequence of calling of some methods of a Python class