graniteswan
graniteswan

Reputation: 69

Calling a Java static function from Clojure

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") )

Upvotes: 0

Views: 626

Answers (1)

Taylor Wood
Taylor Wood

Reputation: 16194

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

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

Upvotes: 2

Related Questions