#
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 parametersName | Type |
---|---|
T | AnyEntity<T> |
#
Constructors#
constructor+ new SerializationContext<T>(populate
: PopulateOptions<T>[]): SerializationContext<T>
#
Type parameters:Name | Type |
---|---|
T | AnyEntity<T> |
#
Parameters:Name | Type |
---|---|
populate | PopulateOptions<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â–¸ Private
isMarkedAsPopulated(prop
: string): boolean
#
Parameters:Name | Type |
---|---|
prop | string |
Returns: boolean
Defined in: packages/core/src/entity/EntityTransformer.ts:63
#
leaveâ–¸ leave<U>(entityName
: string, prop
: string): void
#
Type parameters:Name |
---|
U |
#
Parameters:Name | Type |
---|---|
entityName | string |
prop | string |
Returns: void
Defined in: packages/core/src/entity/EntityTransformer.ts:34
#
visitâ–¸ visit(entityName
: string, prop
: string): boolean
#
Parameters:Name | Type |
---|---|
entityName | string |
prop | string |
Returns: boolean
Defined in: packages/core/src/entity/EntityTransformer.ts:19
#
propagateâ–¸ Static
propagate(root
: SerializationContext<AnyEntity<any>>, entity
: AnyEntity<any>): void
When initializing new context, we need to propagate it to the whole entity graph recursively.
#
Parameters:Name | Type |
---|---|
root | SerializationContext<AnyEntity<any>> |
entity | AnyEntity<any> |
Returns: void
Defined in: packages/core/src/entity/EntityTransformer.ts:46