C

ChildWriteContext

An IWriteContext implementation that wraps a given instance and delegates most of the calls to it but allows for modifying lookup and serialization properties.
ImplementsInheritance Hierarchy

Remarks

Whenever it is necessary to locally modify some context properties, a new instance of this class should be created that wraps an existing one.

Members

Show:

Constructors

Initializes a new instance of the ChildWriteContext class that delegates to the given parent context.

Parameters

parentContext: IWriteContext
The parent context.
Initializes a new instance of the ChildWriteContext class that delegates to the provided context and returns the given value in getCurrent.

Parameters

parentContext: IWriteContext
The parent context to delegate calls to.
currentObject: any
The current object to return in getCurrent.

Properties

Gets the currently active graph object.
readonlyfinal
Gets the current nesting of graphs and graph elements.
The list contains the user objects which correspond to the GraphML elements.
readonlyfinal
Gets the parent context to which most calls are delegated.
readonlyfinal

Property Value

The parent context.
Gets an implementation of IWriteEvents that allows to subscribe to various events in the write process.
readonly
Gets or sets the writer.
If a null writer is set, this implementation will delegate to the parentContext's writer.
final

Methods

Returns the most current (the last element) within the container hierarchy as it is returned by objectStack or default(T) if the most current element is not of the desired target type.
final

Parameters

itemType: Constructor<T>
The desired target type.

Return Value

T
The most current element within the container hierarchy or default(T).
Get a property value that specifies information about how to handle specific cases

Parameters

key: string
The identifier for the property

Return Value

any
The property value, or null if no such property exists
Returns an instance that implements the given type or null.
Typically, this method will be called to obtain a different view or aspect of the current instance. This is quite similar to casting or using a super type or interface of this instance, but is not limited to inheritance or compile-time constraints. An instance implementing this method is not required to return non-null implementations for the types, nor does it have to return the same instance any time. Also, it depends on the type and context whether the instance returned stays up to date or needs to be re-obtained for further use.

Parameters

type: Constructor<T>
the type for which an instance shall be returned

Return Value

T
an instance that is assignable to the type or null

Implements

ILookup.lookup
Removes a local lookup override that has been added using setLookup

Parameters

tType: Constructor<T>
The type key to remove.
Removes a previously locally set serialization property.

Parameters

key: string
The key for which the local property override should be removed.
Serialize the item.
This method calls serializeCore with context as first argument and should be used in virtually all cases.

Parameters

targetType: Constructor<T>
The type of the object that is serialized.
item: T
The object that should be serialized.

Throws

Exception ({ name: 'SerializationNotSupportedError' })

See Also

Developer's Guide
API
serializeCore
Serializes the specified item using the provided type information.
item should be assignable to type t. This method simply delegates to serializeCore, using the correct type parameter.

Parameters

item: any
The item to serialize.
t: Constructor
The type the item is known to be of at deserialization time.
Serialize item to an XML representation.
Client code should usually use the method serialize instead to ensure the correct context instance is used.

Parameters

targetType: Constructor<T>
The type of the object that is serialized.
context: IWriteContext
The current write context.
item: T
The object that should be serialized.
Serialize a replacement object replacement instead of the original originalItem.
Calling this method allows remembering the original object instance, even if the object is actually written through a MarkupExtension or similar replacement mechanisms.

Parameters

targetType: Constructor<T>
originalItem: any
The original object that should be serialized.
replacement: T
The replacement object that will actually be serialized instead.

Throws

Exception ({ name: 'SerializationNotSupportedError' })

See Also

API
serializeCore
Adds another lookup result to the local lookup override.

Parameters

tType: Constructor<T>
The type to use as a key for the lookup.
value: T
The value to provide for queries to T.

See Also

API
removeLookup
Sets the local serialization property for the given key to the value.

Parameters

key: string
The key to override.
value: any
The value.