Support for recursively converting Java beans to Clojure and vice versa.
Support for recursively converting Java beans to Clojure and vice versa.
Specify the behavior of missing setters in to-java in the default object case, using one of :ignore, :log, :error
The default (:ignore) is to ignore missing setters.
If you bind this to :log, you must have org.clojure/tools.logging as a dependency in your project. Otherwise, :log will behave like :error and throw a NoSuchFieldException.
Specify the behavior of missing setters in to-java in the default object case, using one of :ignore, :log, :error The default (:ignore) is to ignore missing setters. * :log uses clojure.tools.logging/info to log a message. * :error throws a NoSuchFieldException. If you bind this to :log, you must have org.clojure/tools.logging as a dependency in your project. Otherwise, :log will behave like :error and throw a NoSuchFieldException.
Convert a Java object to a Clojure map.
Convert a Java object to a Clojure map.
Convert a Java object to a Clojure map (converting deeply).
The second argument is a hash map that offers some control over the 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).
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:
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.
(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.
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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close