@kephas/core
Version:
Provides a common infrastructure for all the other Kephas Framework components: ambient services, dynamic reflection, composition, application management, and others.
99 lines (98 loc) • 3.04 kB
TypeScript
import 'reflect-metadata';
import { AbstractType } from '../type';
/**
* Base class for serializable objects.
*
* @export
* @abstract
* @class Serializable
*/
export declare abstract class Serializable {
private static _typeFullNameKey;
private static _typeNamespaceKey;
/**
* Gets or sets the name of the key holding the type's full name.
*
* @static
* @type {string}
* @memberof Serializable
*/
static get TypeFullNameKey(): string;
static set TypeFullNameKey(value: string);
/**
* Sets the type name for serialization/deserialization purposes.
*
* @static
* @template T
* @param {AbstractType} type The type where the full name should be set.
* @param {string} typeFullName The type's full name.
*
* @memberOf Serializable
*/
static setTypeFullName(type: AbstractType, typeFullName: string): void;
/**
* Sets the type namespace for serialization/deserialization purposes.
*
* @static
* @template T
* @param {AbstractType} type The type where the type name should be set.
* @param {string} namespace The type namespace.
*
* @memberOf Serializable
*/
static setTypeNamespace(type: AbstractType, namespace: string): void;
/**
* Gets the type's full name for serialization/deserialization purposes.
*
* @static
* @param {{} | AbstractType} typeOrInstance The type from where the type name should be retrieved.
* @returns {(string | undefined)} The type's full name.
*
* @memberOf Serializable
*/
static getTypeFullName(typeOrInstance: {} | AbstractType): string | undefined;
/**
* Gets the type namespace for serialization/deserialization purposes.
*
* @static
* @param {AbstractType} typeOrInstance The type from where the type name should be retrieved.
* @returns {(string | undefined)} The type name.
*
* @memberOf Serializable
*/
static getTypeNamespace(typeOrInstance: AbstractType): string | undefined;
/**
* Converts the provided object to a JSON representation.
*
* @static
* @param {object} obj The object to be converted.
* @returns {*} The object containing the JSON representation.
* @memberof Serializable
*/
static getJSON(obj: object): {};
/**
* Converts the provided object to a string.
*
* @static
* @param {object} obj The object to be converted.
* @returns {string} The object's string representation.
* @memberof Serializable
*/
static getString(obj: object): string;
/**
* Converts this object to a JSON representation.
*
* @returns {{}}
*
* @memberOf Serializable
*/
toJSON(): any;
/**
* Converts this object to a string.
*
* @returns {string}
*
* @memberOf Serializable
*/
toString(): string;
}