I've been testing Kryo for serialization and deserialization recently and have generally been happy with it, however it is not clear to be how to handle the (de)serialization of a class which contains an object array. The class contains final fields, so I don't seem to be able to use the default FieldSerializer (The error being "Class cannot be created (missing no-arg constructor)", but a no-arg constructor being inappropriate for a final primitive). So, given the class
@AllArgsConstructor
public class DataObject{
private final double field1;
private final double field2;
private SubObject[] children;
}
@AllArgsConstructor
public class SubObject{
private final double field1;
private final double field2;
}
How would one efficiently write a serializer/deserializer to handle this? My assumption is that I'm missing something in com.esotericsoftware.kryo.io.Input which will let me do this in a custom serializer, but that might be the wrong track..