Skip to content

Commit 9abb96c

Browse files
committed
1 parent 3d26439 commit 9abb96c

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎scijava/scijava-persist/README.md‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
#Scijava mechanism for object serialization
1+
# Scijava mechanism for object serialization
22

3-
This incubator contains a mechanism that uses Scijava extensibility mechanism in order to register adapters that can be dispatched in multiple repositories.
3+
The goal of scijava persist is to serialize 'easily' and in a human readable way objects (interfaces) which can't be directly serialized. Gson can do that conveniently. It's mainly what QuPath uses for all sorts of things, and that's why I came to use it.
4+
5+
In brief: you can serialize interfaces with gson, but gson needs to be aware of all implementations that may exist, which are potentially in different repositories.
6+
7+
For a practical example: I need to serialize RealTransform objects. There are many implementations, most are in imglib2-realtransform, some in bigwarp (Wrapped2DTransformAs3D), and some in bigdataviewer-biop-tools (Elliptical3DTransform).
8+
9+
With scijava-persist, you can create a (custom) serializer for each implementation, in different repositories. With the scijava discovery mechanism, you can just ask for a scijava serializer and it'll be aware of all implementations of all realtransform objects, provided that a serializer plugin was declared.
10+
11+
Thus if somebody comes with an exotic transform in an exotic repository, I could serialize this object conveniently, without modifiying anything in my code.
412

513
Internally the Gson library is used with `RunTimeAdapters`, which allow to serialize interfaces.
614

715
TODO:
816
* simple examples
917
* tests
10-
* think about safety, or at least debugging ease (put a UUID)
18+
* think about safety, or at least debugging ease (put a UUID)

0 commit comments

Comments
 (0)