Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DataSerializer

Allows the serialization and deserialization of objects using the SerializableObject decorator.

Usage

Registration

Objects are registered upon loading with the SerializableObject decorator. Manual registration is possible using:

DataSerializer.registerType(MyObjectClass);

Hierarchy

  • DataSerializer

Index

Constructors

constructor

Accessors

Static serializableTypes

  • get serializableTypes(): (new () => any)[]

Methods

Static deserialize

  • deserialize<T>(serializedData: any, dataType?: new () => T): T
  • deserialize<T>(serializedData: any[], dataType?: new () => T): T[]
  • Deserialize data

    Type parameters

    • T

    Parameters

    • serializedData: any

      Data to deserialze

    • Optional dataType: new () => T

      Optional data type to specify deserialization type

        • new (): T
        • Returns T

    Returns T

  • Type parameters

    • T

    Parameters

    • serializedData: any[]
    • Optional dataType: new () => T
        • new (): T
        • Returns T

    Returns T[]

Static Protected deserializeArray

  • deserializeArray<T>(serializedData: any[], dataType?: new () => T): T[]
  • Type parameters

    • T

    Parameters

    • serializedData: any[]
    • Optional dataType: new () => T
        • new (): T
        • Returns T

    Returns T[]

Static findRootMetaInfo

  • findRootMetaInfo(proto: any): JsonObjectMetadata

Static findTypeByName

  • findTypeByName(name: string): new () => any

Static registerType

  • registerType(type: new () => any): void
  • Manually register a new type

    Parameters

    • type: new () => any

      Type to register

        • new (): any
        • Returns any

    Returns void

Static serialize

  • serialize<T>(data: T): any
  • Serialize data

    Type parameters

    • T: unknown

    Parameters

    • data: T

      Data to serialize

    Returns any

    Serialized data

Static Protected serializeArray

  • serializeArray<T>(data: T[]): any[]

Static Protected serializeObject

  • serializeObject<T>(data: T, dataType: new () => T): any

Static unregisterType

  • unregisterType(type: new () => any): void