I have a Java class that I'd like to use in Clojure. But, I want to use it as a Clojure map. What are the steps required to do so?
I've looked at the code for IPersistentMap
-- should the Java class implement that? Or should there be some Clojure code which implements a protocol?
I know I could just write some mapping code, to explicitly convert the code from Java objects to maps, but that solution has a high effort/reward ratio. Also, I might encounter this same situation many more times.
Concrete example: I have a parser written in Java. I'd like to use that to parse some text, and then access the contents of the parsed data structure as though it were in Clojure maps:
(def parser (new MyParser))
(let [parse-tree (parser ... parse some text ...)]
((parse-tree :items) "itemid"))