Open constantinpape opened 3 years ago
cc @martinschorb @NicoKiaru @tischi
@NicoKiaru
Do you know if the convention is to put the "type" only in case of the field being an interface? Would make sense to me, because if it is not an interface, on the Java code side, it is clear from the class of the field what it should be.
However, from human readability point of view it could be nice to spell out the type also if it is not an interface, but then I think one looses quite some of the convenience of the JSON magic.
Do you know if the convention is to put the "type" only in case of the field being an interface?
I think so, in fact in most cases you don't need to write adapters, because the object can be easily serialized. It's not really a convention, it's because there's no other convenient.
However, from human readability point of view it could be nice to spell out the type also if it is not an interface, but then I think one looses quite some of the convenience of the JSON magic.
Gson is powerful and configurable, it is probably possible to set it in such a way that the type of the object is always written (but what happens if you serialize an int?)
https://github.com/BIOP/qupath-biop-extensions/tree/imglib2-include/src/main/java/ch/epfl/biop/qupath/transform