These bindings are created to simplify interaction with java classes from clojure. For each java class was created a separate namespace. Each method/field has its own function/field binding. Their names are changed for a more native look in the clojure code. Each function has docstring - information about the parameters, return value and possible exceptions.
All namespaces starting with java. are renamed to jdk. (java compiler limitation).
java.io.File renamed to jdk.io.File for example.
You can find clojars in README of packages.
(require '[jdk.io.File :as f])
(-> "./resource/MyFile.txt"
f/->file
f/exists?)
(-> "./resource/MyAnotherFile.txt"
f/->file
f/mkdirs)
Class Member | Java | Clojure |
---|---|---|
constructor | new File() | (->file) |
instance method | getAnyValue() | (get-any-value) |
instance field | instanceField | (-instance-field) |
static method | staticMethod() | (*static-method) |
static field | ANY_STATIC_FIELD | (*-any-static-field) |
boolean field/method | isExists(), canUse() | (exists?), (can-use?) |
Distributed under the Eclipse Public License, the same as Clojure.