An IInputHandler implementation that uses an IMapper<K,V> instance to associate the values with the keys.
Remarks
This implementation can be provided an HandleDeserializationEventArgs-handler to perform the deserialization. If no such value is provided then the default deserialization is performed.
The parsed values are stored in a IMapper<K,V>.
Type Parameters
- TKey
- The type of the key.
- TData
- The type of the value.
Type Details
- yfiles module
- view-graphml
- yfiles-umd modules
- view-graphml, view
- Legacy UMD name
- yfiles.graphml.MapperInputHandler
Constructors
Initializes a new instance of the MapperInputHandler<TKey,TData> class that uses the IParseContext for deserialization.
Remarks
Parameters
A map of options to pass to the method.
MapperInputHandler
(keyType: Class, dataType: Class, deserializer: function(Object, HandleDeserializationEventArgs):void, deserializerTargetType?: Class)Initializes a new instance of the MapperInputHandler<TKey,TData> class that uses the event handler for deserialization and suggests the provided target type for the deserializer.
Parameters
A map of options to pass to the method.
- keyType - Class
- The type of the key.
- dataType - Class
- The type of the value.
- deserializer - function(Object, HandleDeserializationEventArgs):void
Signature Details
function(sender: this, evt: HandleDeserializationEventArgs)
Represents the method that will handle an event when the event provides data.Parameters
- sender - this
- The source of the event.
- evt - HandleDeserializationEventArgs
- An object that contains the event data.
- deserializerTargetType - Class
See Also
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 property.
Remarks
true
, the applyDefault method will call the setValue method using the defaultValue as the value parameter.Defined in
Gets or sets the default value that will be applied to the keys where the data attribute is missing.
Remarks
null
), defaultExists is automatically set to true.Defined in
Gets or sets the deserializer.
Signature Details
function(sender: this, evt: HandleDeserializationEventArgs)
Parameters
- sender - this
- The source of the event.
- evt - HandleDeserializationEventArgs
- An object that contains the event data.
Gets or sets the target deserialization type for the targetType property.
Gets or sets the mapper to use for storing the data.
Gets or sets a value indicating whether values that are applied via the applyDefault mechanism and are equal to the value that is already present in the mapper will explicitly be overridden in the mapper.
Gets or sets a value indicating whether the default value in the key definition should be parsed.
Defined in
Gets or sets the parse precedence that is associated with this handler.
Implements
Gets or sets whether getDeserializationXmlNode returns either the 'data'
/'default'
element itself or its content.
Remarks
false
, meaning that getDeserializationXmlNode should return the content of the 'data'
/'default'
node.See Also
Methods
Overridden to take the overrideDefaultValue property into account.
Parameters
A map of options to pass to the method.
- context - IParseContext
- The context for the parse operation.
See Also
Overrides
Gets the node to pass to deserializer or IParseContext.Deserialize respectively, given the 'data' or 'default' element from the GraphML.
Remarks
This method is called by parseDataCore to determine the node to pass to the deserialization mechanism.
This implementation returns node
iff useParentElementForDeserialization 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.
Parameters
A map of options to pass to the method.
- context - IParseContext
- The context within which the node is parsed.
- node - Node
- The 'data' or 'default' node.
Returns
- ↪Node
- The node that should be deserialized.
See Also
Initializes this instance from the GraphML key definition.
Remarks
Parameters
A map of options to pass to the method.
- context - IParseContext
- The context.
- definition - Element
- The definition.
Defined in
This method is invoked each time a data element with matching key is processed.
Remarks
TKey
, it is used as key parameter in the setValue call. Otherwise null
is passed as key so the data can be stored temporarily until the key element was created.Parameters
A map of options to pass to the method.
- context - IParseContext
- the current parse context.
- node - Node
- the DOM node representing the data element.
See Also
Implements
Parses the data using either the deserializer or the deserializeCore call.
Parameters
A map of options to pass to the method.
- context - IParseContext
- The context.
- node - Node
- The node that contains the data. This is either the GraphML
'data'
element or the'default'
element.
Returns
- ↪TData
- The parsed data.
Throws
- Exception({ name: 'DeserializationNotSupportedError' })
DeserializationNotSupportedException
if deserializer could not handle the node.
See Also
Implements
This method uses the mapper to associate the data with the key.
Parameters
A map of options to pass to the method.
- context - IParseContext
- The context.
- key - TKey
- The key.
- data - TData
- The data.