[cl-prevalence-devel] Extending the serializer
Ian Eslick
eslick at media.mit.edu
Mon Feb 2 23:46:47 UTC 2009
I've extended cl-prevalence slightly to support some custom
serialization and deserialization of user data types. The attached
diff contains a patch that allows users to hook into the serialization
protocol at the appropriate places.
Here is an example of how to hook into the protocol. The last two
functions (of 3) were added in the diff.
;; Serializer support for persistent objects
(defmethod s-serialization::serialize-xml-internal ((object
persistent) stream serialization-state)
(declare (ignore serialization-state))
(write-string "<PERSISTENT ID=\"" stream)
(prin1 (oid object) stream)
(write-string "\"/>" stream))
(defmethod s-serialization::deserialize-xml-new-element-aux
((name (eql :persistent)) attributes)
(elephant::controller-recreate-instance *store-controller*
(parse-integer (s-serialization::get-attribute-value :id
attributes))))
;; Not needed in this app:
;; (defgeneric deserialize-xml-finish-element-aux ((name
(eql :persistent)) attributes parent-seed seed)
;; seed)
Regards,
Ian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: serialization-generalize.diff
Type: application/octet-stream
Size: 1497 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/cl-prevalence-devel/attachments/20090202/f03bb747/attachment.obj>
-------------- next part --------------
More information about the Cl-prevalence-devel
mailing list