I need to encode a Point(x, y) as `[x, y]`. There ...
# serialization
a
I need to encode a Point(x, y) as
[x, y]
. There seems to be many ways of doing it. The simplest is to read it as a
List<Float>
but I’d like to avoid boxing the floats if possible on the JVM. There is
beginStructure
and
beginCollection
but no documentation on when to use either or.
a
Ah, there are a bunch of more useful methods to implement
I would assume that
addElement
handles a lot of the stuff but maybe that’s not for list types?
d
Yes but only if you use
SerialClassDescImpl
.
a
Right, any downside to that?
d
None that I know of.
I got my implementation from the existing List serializers.
a
Ah, right. It makes sense that they would use a more optimized version