| | |
| | | |
| | | /** @typedef {{ serialize: (context: ObjectSerializerContext) => void, deserialize: (context: ObjectDeserializerContext) => void }} SerializableClass */ |
| | | /** |
| | | * Defines the serializable class constructor type used by this module. |
| | | * @template {SerializableClass} T |
| | | * @typedef {(new (...params: EXPECTED_ANY[]) => T) & { deserialize?: (context: ObjectDeserializerContext) => T }} SerializableClassConstructor |
| | | */ |
| | | |
| | | /** |
| | | * Represents ClassSerializer. |
| | | * @template {SerializableClass} T |
| | | */ |
| | | class ClassSerializer { |
| | | /** |
| | | * Creates an instance of ClassSerializer. |
| | | * @param {SerializableClassConstructor<T>} Constructor constructor |
| | | */ |
| | | constructor(Constructor) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Serializes this instance into the provided serializer context. |
| | | * @param {T} obj obj |
| | | * @param {ObjectSerializerContext} context context |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * Restores this instance from the provided deserializer context. |
| | | * @param {ObjectDeserializerContext} context context |
| | | * @returns {T} obj |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * Processes the provided constructor. |
| | | * @template {Constructor} T |
| | | * @param {T} Constructor the constructor |
| | | * @param {string} request the request which will be required when deserializing |