|
1 | 1 | # java.data
|
2 | 2 |
|
3 | 3 | Functions for recursively converting Java beans to Clojure and vice
|
4 |
| -versa. Future home of Java beans and properties support from the old |
5 |
| -clojure-contrib |
| 4 | +versa. |
| 5 | + |
| 6 | +You can perform shallow conversions and deep conversions, and `java.data` |
| 7 | +provides quite a bit of control over the conversion process. |
| 8 | + |
| 9 | +Conversion of Clojure maps etc to specific Java types is generally fairly |
| 10 | +straightforward, either via regular construction or via "builder" APIs. |
| 11 | + |
| 12 | +Some Java types, however, are going to be difficult to convert to Clojure, |
| 13 | +e.g., Protobuf is particularly problematic because it is all recursive metadata |
| 14 | +about types and values: even when you use `:omit` to avoid deep recursion in |
| 15 | +an automated conversion, you are not necessarily going to get a useful result. |
6 | 16 |
|
7 | 17 | ## Releases and Dependency Information
|
8 | 18 |
|
@@ -59,6 +69,11 @@ org.clojure/java.data {:mvn/version "1.3.113"}
|
59 | 69 | ;; represent a javaValue instance in a Clojure data structure:
|
60 | 70 | (j/from-java javaValue)
|
61 | 71 |
|
| 72 | +;; from-java is the legacy, default API and offers no control over the |
| 73 | +;; conversion process; from-java-shallow and from-java-deep accept options |
| 74 | +;; that provide control over which properties to omit, how to handle property |
| 75 | +;; methods that fail, etc, and should be preferred over the default from-java |
| 76 | + |
62 | 77 | ;; populate javaValue instance from a Clojure property hash map
|
63 | 78 | ;; (calls a setter for each key/value pair in the hash map):
|
64 | 79 | (j/set-properties javaValue clojure-property-map)
|
|
0 commit comments