Let's say there is a Java class with a non-static enum field like below.
package com.example;
public class Crypter {
public enum KeyPlacement {
PEER,
INLINE
}
private KeyPlacement keyPlacement;
public KeyPlacement getKeyPlacement() {
return this.keyPlacement;
}
public void setKeyPlacement(final KeyPlacement newKeyPlacement) {
this.keyPlacement = newKeyPlacement;
}
}
Setting keyPlacement
value from Clojure can be done as follows.
(ns core
(:import [com.example Crypter Crypter$KeyPlacement]))
(doto (Crypter.)
(.setKeyPlacement Crypter$KeyPlacement/INLINE))
When compiling the above source, inner classes, enums etc. gets generated with $
appended as Crypter$KeyPlacement
. So we can import those and access them from Clojure.