benbro00002
benbro00002

Reputation: 151

Is there a way to create java objects from clojure maps?

is there a way to create java objects from Clojure maps? something where the following would hold - (= my-map (bean (convert-to-object my-map)))

Upvotes: 0

Views: 167

Answers (2)

Olim Saidov
Olim Saidov

Reputation: 2844

Take a look at https://github.com/uwcpdx/bean-dip

Bidirectional translation between Clojure maps and Java beans that's declarative and reflection-free

Upvotes: 0

Sean Corfield
Sean Corfield

Reputation: 6666

You would need to tell it what type of Java object you wanted to create. Take a look at the org.clojure/java.data Contrib library which can build Java objects from hash maps (via constructors, via property setters, via builders): https://github.com/clojure/java.data

Upvotes: 2

Related Questions