An IWriteContext implementation that wraps a given instance and delegates most of the calls to it but allows for modifying lookup and serialization properties.
Implements
- I
- I
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.
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.
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.
Gets the currently active graph object.
readonlyfinal
Implements
IWriteContext.graphGets the current nesting of graphs and graph elements.
Gets the current nesting of graphs and graph elements.
The list contains the user objects which correspond to the GraphML elements.
readonlyfinal
Implements
IWriteContext.objectStackGets the parent context to which most calls are delegated.
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.
Gets an implementation of IWriteEvents that allows to subscribe to various events in the write process.
readonly
Implements
IWriteContext.writeEventsGets or sets the writer.
Gets or sets the writer.
final
Implements
IWriteContext.writerMethods
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.
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).
Implements
IWriteContext.getCurrentParameters
- key: string
- The identifier for the property
Return Value
- any
- The property value, or
nullif no such property exists
Implements
IWriteContext.getSerializationPropertyTypically, 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.lookupRemoves a local lookup override that has been added using setLookup
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.
Removes a previously locally set serialization property.
Parameters
- key: string
- The key for which the local property override should be removed.
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
Defined in
IWriteContext.serializeitem 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.
Defined in
IWriteContext.serializeSerialize item to an XML representation.
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.
Implements
IWriteContext.serializeCoreCalling 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
Defined in
IWriteContext.serializeReplacementParameters
- 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