From 4e2c24642fc258e022bfc27fd87ffdb4c789ae31 Mon Sep 17 00:00:00 2001 From: Peter Taoussanis Date: Fri, 10 Jun 2016 11:18:55 +0700 Subject: [PATCH] Misc housekeeping --- README.md | 6 +++--- src/taoensso/nippy.clj | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c1956a5..313f0f5 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ nippy/stress-data :uuid (java.util.UUID/randomUUID) :date (java.util.Date.) - :stress-record (->StressRecord "data") + :stress-record (StressRecord. "data") ;; Serializable :throwable (Throwable. "Yolo") @@ -152,9 +152,9 @@ There's two default forms of encryption on offer: `:salted` and `:cached`. Each (nippy/extend-thaw :my-type/foo ; Same type id [data-input] - (->MyType (.readUTF data-input))) + (MyType. (.readUTF data-input))) -(nippy/thaw (nippy/freeze (->MyType "Joe"))) => #taoensso.nippy.MyType{:data "Joe"} +(nippy/thaw (nippy/freeze (MyType. "Joe"))) => #taoensso.nippy.MyType{:data "Joe"} ``` ## Performance diff --git a/src/taoensso/nippy.clj b/src/taoensso/nippy.clj index 5bd1be5..a44bbe2 100644 --- a/src/taoensso/nippy.clj +++ b/src/taoensso/nippy.clj @@ -1368,10 +1368,10 @@ (defmacro extend-thaw "Extends Nippy to support thawing of a custom type with given id: (extend-thaw :foo/my-type [data-input] ; Keyword id - (->MyType (.readUTF data-input))) + (MyType. (.readUTF data-input))) ;; or (extend-thaw 1 [data-input] ; Byte id - (->MyType (.readUTF data-input)))" + (MyType. (.readUTF data-input)))" [custom-type-id [in] & body] (assert-custom-type-id custom-type-id) `(do @@ -1389,8 +1389,8 @@ *custom-readers* (defrecord MyType [data]) (extend-freeze MyType 1 [x out] (.writeUTF out (:data x))) - (extend-thaw 1 [in] (->MyType (.readUTF in))) - (thaw (freeze (->MyType "Joe")))) + (extend-thaw 1 [in] (MyType. (.readUTF in))) + (thaw (freeze (MyType. "Joe")))) ;;;; Stress data @@ -1452,7 +1452,7 @@ :uuid (java.util.UUID/randomUUID) :date (java.util.Date.) - :stress-record (->StressRecord "data") + :stress-record (StressRecord. "data") ;; Serializable :throwable (Throwable. "Yolo")