Questions tagged [gen-class]

gen-class automatically generates Java classes from Clojure code.

36 questions
1
vote
1 answer

How can I pass in the list of methods to gen-class?

When using gen-class this compiles fine: (ns clj.sandbox) (defn -hello [this] "Hello World") (gen-class :name com.sandbox.GeneratedClass :methods [[hello [] String]]) But if you do this: (ns clj.sandbox) (def my-methods (atom [[hello []…
Daniel Kaplan
  • 62,768
  • 50
  • 234
  • 356
0
votes
2 answers

How do I compile and use a class defined with gen-class in the repl and/or tests?

Clojure noob. I'm unable to get a basic example with :gen-class working. $ lein new app pizza-parlor ; project.clj (defproject pizza-parlor "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license…
Sasgorilla
  • 2,403
  • 2
  • 29
  • 56
0
votes
1 answer

clojure gen-class with annotation that require enum parameter

I want to write a clojure lib and exposes generated classes, so that other java projects could use it. I read and followed the gen-class doc, and everything works as my expect, except class annotation with enum parameters. (ns…
lizhen
  • 1
0
votes
0 answers

boot-clj: how to build/launch unit test for class generated with gen-class

In my clojure project I built several java classes using gen-class command. They are [extractor.yaml YAMLExtractor YAMLExtractorFactory]. I wanted now build unit test against those classes but I have error: java.lang.ClassNotFoundException:…
Jacek
  • 11
  • 4
0
votes
1 answer

How to call a gen-class method from clojure

I'm Using gen-class to generate Java-classes from my Clojure code. In order to make gen-class work, I need to add an additional first parameter to all methods that will be added to the class (here called this). (ns…
Edward
  • 4,453
  • 8
  • 44
  • 82
0
votes
3 answers

Gen-Class does not generate a .class file

I'd like to use Clojure code within Java. The Clojure code itself should implement a Java-interface (TestGenClassInterface). My project.clj is: (defproject com.stackoverflow.clojure/tests "0.1.0-SNAPSHOT" :description "Tests of Clojure…
Edward
  • 4,453
  • 8
  • 44
  • 82
1 2
3