An IInputHandler implementation that uses an IMapper<K,V> instance to associate the values with the keys.
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.
Type Details
- yFiles module
- view
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.
- keyType - Constructor<TKey>
- The type of the key.
- dataType - Constructor<TData>
- The type of the value.
MapperInputHandler
(keyType: Constructor<TKey>, dataType: Constructor<TData>, deserializer: function(IParseContext, Node, Constructor):TData, deserializerTargetType?: Constructor)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
A map of options to pass to the method.
- keyType - Constructor<TKey>
- The type of the key.
- dataType - Constructor<TData>
- The type of the value.
- deserializer - function(IParseContext, Node, Constructor):TData
- The callback used to deserialize.
Signature Details
function(arg1: IParseContext, arg2: Node, arg3: Constructor) : TData
Encapsulates a method that has three parameters and returns a value of the type specified by theTResult
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.
Returns
- TData
- The return value of the method that this delegate encapsulates.
- deserializerTargetType - Constructor
- The type that should be suggested for the deserializer.
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.Property Value
true
if the default value exists; false
otherwise.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.Property Value
Defined in
Gets or sets the deserializer.
Property Value
Signature Details
function(arg1: IParseContext, arg2: Node, arg3: Constructor) : TData
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.
Returns
- TData
- The return value of the method that this delegate encapsulates.
Gets or sets the target deserialization type for the targetType property.
Property Value
Gets or sets the mapper to use for storing the data.
Property Value
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.
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.
Property Value
true
if the default value should be parsed; false
otherwise. The default is true
.Defined in
Gets or sets the parse precedence that is associated with this handler.
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 a matching key is processed.
Remarks
TKey
, it is used as the key parameter in the setValue call. Otherwise, null
is passed as the key so the data can be stored temporarily until the key element is 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.