abstract class HSMOD.REST.SerializationProxy extends %Library.RegisteredObject
Common base class for serializing persistent classes for the purposes of REST-enabled application modules. If the class and all its contents are registered only (not persistent), then this machinery is unnecessary. If the properties of the proxy are datatypes, non-swizzlable registered classes and/or other serialization proxy classes, then we can generate methods for serializing and de-serializing. Currently does not handle serial objects.
Suppose we have a persistent class and we want to send and receive JSON representations of that class. The serialization class acts as an intermediary and has methods to generate itself from the persistent class, as well as to create or find-and-update the existing persistent object using the values in a proxy object. If the class has an IdKey, it is used to find and open existing objects; otherwise the proxy class must have a designated property for storing the internal ID (identified via a class parameter). The serialization class is then what's used generate the JSON, and vice versa.
The proxy deals with only an explicit subset of the properties; we do not automatically generate properties for the proxy.
The proxy object has no built-in machinery for serializing or de-serializing itself to/from JSON. The assumption is that the modules will use the HS.JSON module's read/write methods for that.
Each such class needs to be specifically extended from HSMOD.REST.SerializationProxy, typically by simply specifying properties. Properties in the serialization class must have the same name as a property in the associated class, and will be associated automatically. The extension would typically be in a "Foo.Auxil" package of an application or module.@API.Object @API.Extensible