Currently Savables are required to have a parameterless constructor in order to be deserialized by a JmeImporter. This puts some fairly major restrictions on how classes are implemented, even ones that don't implement Savable. I think this can be fixed by allowing Savable classes to specify a static builder method, which is responsible only for instantiating the Savable from the InputCapsule. Further deserialization is performed using the normal read method.
public class MySavable implements Savable {
@SavedObjectBuilder
public static Savable loadSave(InputCapsule in) throws IOException {
return new MySavable(in.readInt("value", 0));
}
}
I've already managed to implemented this on my vulkan fork without any outright breaking changes, so I am curious if this is something we want in jme3 (or whether we want this at all).
Currently Savables are required to have a parameterless constructor in order to be deserialized by a JmeImporter. This puts some fairly major restrictions on how classes are implemented, even ones that don't implement Savable. I think this can be fixed by allowing Savable classes to specify a static builder method, which is responsible only for instantiating the Savable from the InputCapsule. Further deserialization is performed using the normal read method.
I've already managed to implemented this on my vulkan fork without any outright breaking changes, so I am curious if this is something we want in jme3 (or whether we want this at all).