API for clojure.java.data - java.data 1.0.65-SNAPSHOT (in development)

by Cosmin Stejerean, Sean Corfield

Full namespace name: clojure.java.data

Overview

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

Public Variables and Functions



*to-java-object-missing-setter*

dynamic var

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

    
    
    Source
  


set-properties

function
Usage: (set-properties instance props)
Given an existing Java object and a Clojure map, use reflection to
set the properties.

    
    
    Source
  

clojure.java.data.builder

A variant of clojure.java.data/to-java that uses a Builder class
to build the requested class from a hash map of properties.

Public Variables and Functions



to-java

function
Usage: (to-java clazz props)
       (to-java clazz props opts)
       (to-java clazz instance props opts)
       (to-java clazz builder instance props opts)
Given a class and a hash map of properties, figure out the Builder class,
figure out the setters for the Builder, construct an instance of it and
produce an instance of the original class. A hash map of options may also
be provided.

Alternatively, given a class, a builder instance, a hash map of properties,
and a hash map of options, figure out the setters for the builder class,
and use the builder instance to produce an instance of the original class.

Finally, given a class, a builder class, a builder instance (possibly of a
different class), a hash map of properties, and a hash map of options,
figure out the setters for the builder class, and use the builder instance
to produce an instance of the original class.

The following options may be provided:
* :builder-class -- the class that should be used for the builder process;
    by default we'll assume an inner class of clazz called 'Builder',
* :builder-props -- properties used to construct and initialize an instance
    of the builder class; defaults to an empty hash map; may have
    :clojure.java.data/constructor as metadata to provide constructor
    arguments for the builder instance,
* :build-fn -- the name of the method in the Builder class to use to
    complete the builder process and return the desired class;
    by default we'll try to deduce it, preferring 'build' if we find
    multiple candidates,
* :ignore-setters? -- a flag to indicate that methods on the builder
    class that begin with 'set' should be ignored, which may be
    necessary to avoid ambiguous methods that look like builder properties;
    by default 'setFooBar` will be treated as a builder property 'fooBar'
    if it accepts a single argument and returns a builder instance.

    
    
    Source
  
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.