Skip to main content
Version: 4.4

Class: SerializationContext<T>#

core.SerializationContext

Helper that allows to keep track of where we are currently at when serializing complex entity graph with cycles. Before we process a property, we call visit that checks if it is not a cycle path (but allows to pass cycles that are defined in populate hint). If not, we proceed and call leave afterwards.

Type parameters#

NameType
TAnyEntity<T>

Hierarchy#

  • SerializationContext

Constructors#

constructor#

+ new SerializationContext<T>(populate: PopulateOptions<T>[]): SerializationContext<T>

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
populatePopulateOptions<T>[]

Returns: SerializationContext<T>

Defined in: packages/core/src/entity/EntityTransformer.ts:15

Properties#

path#

Readonly path: [string, string][]

Defined in: packages/core/src/entity/EntityTransformer.ts:15

Methods#

isMarkedAsPopulated#

PrivateisMarkedAsPopulated(prop: string): boolean

Parameters:#

NameType
propstring

Returns: boolean

Defined in: packages/core/src/entity/EntityTransformer.ts:63


leave#

leave<U>(entityName: string, prop: string): void

Type parameters:#

Name
U

Parameters:#

NameType
entityNamestring
propstring

Returns: void

Defined in: packages/core/src/entity/EntityTransformer.ts:34


visit#

visit(entityName: string, prop: string): boolean

Parameters:#

NameType
entityNamestring
propstring

Returns: boolean

Defined in: packages/core/src/entity/EntityTransformer.ts:19


propagate#

Staticpropagate(root: SerializationContext<AnyEntity<any>>, entity: AnyEntity<any>): void

When initializing new context, we need to propagate it to the whole entity graph recursively.

Parameters:#

NameType
rootSerializationContext<AnyEntity<any>>
entityAnyEntity<any>

Returns: void

Defined in: packages/core/src/entity/EntityTransformer.ts:46

Last updated on by renovate[bot]