0

I have a java package com.example.Api

I have included it in my project.clj

I have imported it:

(ns prismic-clojure.core
  (:import [com.example.Api])
  (:gen-class))

There is a static 'get' function which, in Java, I would access like:

Api api = Api.get("https://my.company.io/api", "secret-token");

The java function is defined as:

public static Api get(String url, String accessToken)

I have tried this:

(def api (. get Api "https://my.company.io/api" "secret-token") )
4
  • 1
    If it's a method, not a static function, then you need to actually create an Api instance. What's the calling convention for the constructor for that class? Commented Jan 25, 2018 at 17:45
  • (It would also be a good starting point to show what you've tried). Commented Jan 25, 2018 at 17:46
  • it is a static function. added detail to question above Commented Jan 25, 2018 at 17:50
  • 1
    Possible duplicate of Clojure: how do I require a class and call a static method? Commented Jan 25, 2018 at 17:55

1 Answer 1

2

This is how you call a static function on the Api class:

(Api/get "https://my.company.io/api" "secret-token")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.