Question

I'm trying to call a java method (of https://code.google.com/p/metadata-extractor) in clojure which expects a class as parameter.

Java:

metadata.getDirectory(GpsDirectory.class)

My Clojure-Code:

(.getDirectory metadata GpsDirectory)

ends up in the following exception:

IllegalArgumentException Don't know how to create ISeq from: com.drew.metadata.exif.GpsDirectory  clojure.lang.RT.seqFrom (RT.java:505)

I have imported the java lib via namespace

(ns MyProject.exif
(:import [java.io File BufferedInputStream FileInputStream]
       [com.drew.imaging ImageMetadataReader]
       [com.drew.metadata.exif GpsDirectory]
       [com.drew.metadata Directory]))

Does anybody have any idea how to call those methods (expecting a class) in clojure?

Was it helpful?

Solution

Try:

(.getDirectory metadata (class (GpsDirectory.)))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top