Liking cljdoc? Tell your friends :D

clojure.java.data

Support for recursively converting Java beans to Clojure and vice versa.

Support for recursively converting Java beans to Clojure and vice versa.
raw docstring

*to-java-object-missing-setter*clj

Specify the behavior of missing setters in to-java in the default object case, using one of :ignore, :log, :error

Specify the behavior of missing setters in to-java in the
default object case, using one of :ignore, :log, :error
sourceraw docstring

from-javacljmultimethod

Convert a Java object to a Clojure map.

Convert a Java object to a Clojure map.
sourceraw docstring

from-java-deepcljmultimethod

Convert a Java object to a Clojure map (converting deeply).

The second argument is a hash map that offers some control over the conversion:

  • :add-class -- if true, add :class with the actual class of the object being converted -- this mimics clojure.core/bean.
  • :exceptions -- controls how getter exceptions should be handled: * :group -- return an :exceptions hash map in the object that contains all the properties that failed, with their exceptions, * :omit -- ignore exceptions and omit the properties that caused them, * :qualify -- return the exception as :<property>/exception and omit the property itself, * :return -- simply return the exception as the value of the property.
  • :omit -- a set of properties (keywords) to omit from the conversion so that unsafe methods are not called (this applies across the whole recursive/deep conversion).
Convert a Java object to a Clojure map (converting deeply).

The second argument is a hash map that offers some control over the
conversion:
* :add-class -- if true, add :class with the actual class of the object
        being converted -- this mimics clojure.core/bean.
* :exceptions -- controls how getter exceptions should be handled:
        * :group -- return an :exceptions hash map in the object that
              contains all the properties that failed, with their exceptions,
        * :omit -- ignore exceptions and omit the properties that caused them,
        * :qualify -- return the exception as :<property>/exception and
              omit the property itself,
        * :return -- simply return the exception as the value of the property.
* :omit -- a set of properties (keywords) to omit from the conversion
        so that unsafe methods are not called (this applies across the whole
        recursive/deep conversion).
sourceraw docstring

from-java-shallowcljmultimethod

Convert a Java object to a Clojure map (but do not convert deeply).

The second argument is a hash map that offers some control over the conversion:

  • :add-class -- if true, add :class with the actual class of the object being converted -- this mimics clojure.core/bean.
  • :exceptions -- controls how getter exceptions should be handled: * :group -- return an :exceptions hash map in the object that contains all the properties that failed, with their exceptions, * :omit -- ignore exceptions and omit the properties that caused them, * :qualify -- return the exception as :<property>/exception and omit the property itself, * :return -- simply return the exception as the value of the property.
  • :omit -- a set of properties (keywords) to omit from the conversion so that unsafe methods are not called.
Convert a Java object to a Clojure map (but do not convert deeply).

The second argument is a hash map that offers some control over the
conversion:
* :add-class -- if true, add :class with the actual class of the object
        being converted -- this mimics clojure.core/bean.
* :exceptions -- controls how getter exceptions should be handled:
        * :group -- return an :exceptions hash map in the object that
              contains all the properties that failed, with their exceptions,
        * :omit -- ignore exceptions and omit the properties that caused them,
        * :qualify -- return the exception as :<property>/exception and
              omit the property itself,
        * :return -- simply return the exception as the value of the property.
* :omit -- a set of properties (keywords) to omit from the conversion
        so that unsafe methods are not called.
sourceraw docstring

set-propertiesclj

(set-properties instance props)

Given an existing Java object and a Clojure map, use reflection to set the properties.

Given an existing Java object and a Clojure map, use reflection to
set the properties.
sourceraw docstring

to-javacljmultimethod

Convert Clojure data to an instance of the specified Java class. Several basic types have obvious conversions, but for a hash map reflection is used to set the properties. If the class is an interface, we can't create an instance of it, unless the Clojure map already implements it.

When java.time.Instant is available (Java 8+), we can convert a hash map containing :nano and :epochSecond to Instant, as this is the reverse of Instant->map.

A XMLGregorianCalendar object can be constructed from the following keys :year, :month, :day, :hour, :minute, :second, and :timezone.

Convert Clojure data to an instance of the specified Java class.
Several basic types have obvious conversions, but for a hash map
reflection is used to set the properties. If the class is an interface, we
can't create an instance of it, unless the Clojure map already implements it.

When java.time.Instant is available (Java 8+), we can convert a hash map
containing :nano and :epochSecond to Instant, as this is the reverse of
Instant->map.

A XMLGregorianCalendar object can be constructed from the following keys
:year, :month, :day, :hour, :minute, :second, and :timezone.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close