Liking cljdoc? Tell your friends :D
Clojure only.

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.

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

to-javaclj

(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.
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.
sourceraw docstring

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

× close