API for import-static
- ()
by Stuart Sierra
clojure-contrib is now deprecated
clojure-contrib is no longer being developed or maintained.
Rather than a single, monolithic, contributions library, Clojure now has
a set of separate libraries for each unit of functionality. The libraries
are in the Clojure GitHub organization at
https://github.com/clojure.
API documentation of the libraries can be found at
https://clojure.github.io.
If you're looking for a specific function or namespace from the old
clojure-contrib, see
"Where Did Clojure.Contrib Go".
Full namespace name:
clojure.contrib.import-static
Overview
Import static Java methods/fields into Clojure
Public Variables and Functions
import-static
macro
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (import-static class & fields-and-methods)
Imports the named static fields and/or static methods of the class
as (private) symbols in the current namespace.
Example:
user=> (import-static java.lang.Math PI sqrt)
nil
user=> PI
3.141592653589793
user=> (sqrt 16)
4.0
Note: The class name must be fully qualified, even if it has already
been imported. Static methods are defined as MACROS, not
first-class fns.
Source