Version: 4.3

Class: SerializationContext<T>

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(populate: PopulateOptions<T>[]): SerializationContext

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

Parameters:

NameType
populatePopulateOptions<T>[]

Returns: SerializationContext

Properties

path

Readonly path: string[] = []

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


populate

Private Readonly populate: PopulateOptions<T>[]

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

Methods

isMarkedAsPopulated

PrivateisMarkedAsPopulated(path: string): boolean

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

Parameters:

NameType
pathstring

Returns: boolean


leave

leave<U>(path: string): void

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

Type parameters:

Name
U

Parameters:

NameType
pathstring

Returns: void


visit

visit(prop: string): boolean

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

Parameters:

NameType
propstring

Returns: boolean


propagate

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

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

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

Parameters:

NameType
rootSerializationContext<AnyEntity>
entityAnyEntity

Returns: void

Last updated on by Martin Adámek