-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Feature Request / ProposalRequest a feature or propose an ideaRequest a feature or propose an ideaTo be investigated
Description
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).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Feature Request / ProposalRequest a feature or propose an ideaRequest a feature or propose an ideaTo be investigated
Type
Projects
Status
No status