C

MapperInputHandler<TKey, TData>

An IInputHandler implementation that uses an IMapper<K, V> instance to associate the values with the keys.
Implements
Inheritance Hierarchy

Remarks

This implementation can be provided a HandleDeserializationEventArgs-handler to perform the deserialization. If no such value is provided then the default deserialization is performed.

The parsed values are stored in an IMapper<K, V>.

Type Parameters

TKey

The type of the key.

TData

The type of the value.

Members

Show:

Constructors

Initializes a new instance of the MapperInputHandler<TKey, TData> class that uses the IParseContext for deserialization.

Parameters

keyType: Constructor<TKey>
The type of the key.
dataType: Constructor<TData>
The type of the value.
Initializes a new instance of the MapperInputHandler<TKey, TData> class that uses the provided callback for deserialization and suggests the provided target type for the deserializer.

Parameters

keyType: Constructor<TKey>
The type of the key.
dataType: Constructor<TData>
The type of the value.
deserializer: function(IParseContext, Node, Constructor): TData | null
The callback used to deserialize.
Function Details
Encapsulates a method that has three parameters and returns a value of the type specified by the TResult parameter.
Parameters
arg1: IParseContext
The first parameter of the method that this delegate encapsulates.
arg2: Node
The second parameter of the method that this delegate encapsulates.
arg3: Constructor
The third parameter of the method that this delegate encapsulates.
Return Value
TData
The return value of the method that this delegate encapsulates.
deserializerTargetType?: Constructor
The type that should be suggested for the deserializer.

Properties

Gets a value indicating whether a default value has been set, either through a key definition element or explicitly by assigning a value to the defaultValue<TKey, TData> property.
If this property is set to true, the applyDefault<TKey, TData> method will call the setValue<TKey, TData> method using the defaultValue<TKey, TData> as the value parameter.
readonlyfinal

Property Value

true if the default value exists; false otherwise.
Gets or sets the default value that will be applied to the keys where the data attribute is missing.
If any default value is set (including null), defaultExists<TKey, TData> is automatically set to true.
final

Property Value

The default value.
Gets or sets the deserializer.
final

Property Value

The deserializer.
Function Details
Encapsulates a method that has three parameters and returns a value of the type specified by the TResult parameter.
Parameters
arg1: IParseContext
The first parameter of the method that this delegate encapsulates.
arg2: Node
The second parameter of the method that this delegate encapsulates.
arg3: Constructor
The third parameter of the method that this delegate encapsulates.
Return Value
TData
The return value of the method that this delegate encapsulates.
Gets or sets the target deserialization type for the HandleDeserializationEventArgs.targetType property.
final

Property Value

The target type of the deserialization.
Gets or sets the mapper to use for storing the data.
conversionfinal

Property Value

The mapper.
Gets or sets a value indicating whether values that are applied via the InputHandlerBase.applyDefault<TKey, TData> mechanism and are equal to the value that is already present in the mapper will explicitly be overridden in the mapper.
final

Property Value

true if default values should be overridden in the mapper; false otherwise. By default this is set to false.
Gets or sets a value indicating whether the default value in the key definition should be parsed.
final

Property Value

true if the default value should be parsed; false otherwise. The default is true.
Gets or sets the parse precedence that is associated with this handler.
conversionfinal

Property Value

The parse precedence.
Gets or sets whether getDeserializationXmlNode<TKey, TData> returns either the 'data'/'default' element itself or its content.
The default value is false, meaning that getDeserializationXmlNode<TKey, TData> should return the content of the 'data'/'default' node.
final

Methods

Overridden to take the overrideDefaultValue<TKey, TData> property into account.

Parameters

context: IParseContext
The context for the parse operation.
Gets the node to pass to deserializer<TKey, TData> or IParseContext.Deserialize respectively, given the 'data' or 'default' element from the GraphML.

This method is called by parseDataCore<TKey, TData> to determine the node to pass to the deserialization mechanism.

This implementation returns node iff useParentElementForDeserialization<TKey, TData> is true (i.e. the 'data' or 'default' node itself), otherwise the first child of the node that is not a comment or processing instruction.

protected

Parameters

context: IParseContext
The context within which the node is parsed.
node: Node
The 'data' or 'default' node.

Return Value

Node | null
The node that should be deserialized.
Initializes this instance from the GraphML key definition.
This implementation looks for the GraphML default element and delegates to parseDataCore<TKey, TData> if a default is found to store the defaultValue<TKey, TData>.

Parameters

context: IParseContext
The context.
definition: Element
The definition.
This method is invoked each time a data element with a matching key is processed.
This method delegates the actual parsing to parseDataCore<TKey, TData> and sets the value afterwards. If the current element is of the same type as this TKey, it is used as the key parameter in the setValue<TKey, TData> call. Otherwise, null is passed as the key so the data can be stored temporarily until the key element is created.

Parameters

context: IParseContext
The current parse context.
node: Node
The DOM node representing the data element.
Parses the data using either the deserializer<TKey, TData> or the IParseContext.deserializeCore call.
protected

Parameters

context: IParseContext
The context.
node: Node
The node that contains the data. This is either the GraphML 'data' element or the 'default' element.

Return Value

TData | null
The parsed data.

Throws

Exception ({ name: 'DeserializationNotSupportedError' })
DeserializationNotSupportedException if deserializer<TKey, TData> could not handle the node.
This method uses the mapper<TKey, TData> to associate the data with the key.
protected

Parameters

context: IParseContext
The context.
key: TKey | null
The key.
data: TData | null
The data.