5

In Clojure I want to interop to use:

JestClientFactory factory = new JestClientFactory();
factory.setHttpClientConfig(new HttpClientConfig
                    .Builder("http://localhost:9200")
                    .build());

So I wrote some code like so:

 (:import (io.searchbox.client JestClientFactory)
          (io.searchbox.client.config HttpClientConfig$Builder))

 (let [factory (JestClientFactory.)
       http-client-config (-> (HttpClientConfig$Builder "http://localhost:9200")
                           (.build))])

But I am getting the following error when building the jar

Expecting var, but HttpClientConfig$Builder is mapped to class io.searchbox.client.config.HttpClientConfig$Builder

Any help would be great.

Ian Campbell
  • 23,484
  • 14
  • 36
  • 57
perkss
  • 1,037
  • 1
  • 11
  • 37

1 Answers1

4

You lack the . behind HttpClientConfig$Builder. Your code does a static call on a class basically. You need the new from your example.

(-> (HttpClientConfig$Builder. "http://localhost:9200") ; note the `.`
    (.build))
cfrick
  • 35,203
  • 6
  • 56
  • 68