Jon Seltzer
Jon Seltzer

Reputation: 83

Is it possible to use clojure's gen-class macro to generate a class with static fields?

Can the following class be generated using Clojure's gen-class macro?

public class Test {
    public static final String TEST_NAME = "This test's name.";
}

If not, why not?

Upvotes: 2

Views: 416

Answers (1)

Chouser
Chouser

Reputation: 5208

No, gen-class can't generate static fields because gen-class is for introp. It attempts to give you the power to create the kind of classes demanded by other java libs. It is rare for a java lib to require that you provide a class with a particular static field.

Upvotes: 1

Related Questions