Class MapSignal<T>
- Type Parameters:
 T- the element type
ValueSignal instance which enables atomic updates to the value of
 that map entry.- 
Field Summary
Fields inherited from class com.vaadin.signals.Signal
ANYTHING_GOES - 
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMapSignal(SignalTree tree, Id id, Predicate<SignalCommand> validator, Class<T> elementType) Creates a new map signal instance with the given id and validator for the given signal tree with the given element type.Creates a new map signal with the given element type. - 
Method Summary
Modifier and TypeMethodDescriptionasNode()Converts this signal into a node signal.Wraps this signal to not accept changes.clear()Removes all entries from this map.booleanprotected Map<String,ValueSignal<T>> extractValue(Node.Data data) Extracts the value for this signal from the given signal data node.inthashCode()Associates the given value with the given key.putIfAbsent(String key, T value) Creates a new entry with the given value if an entry with the given key doesn't already exist.Removes the mapping for the given key.toString()protected ObjectusageChangeValue(Node.Data data) Gets a reference value that will be used to determine whether a dependency based on previous usage should be invalidated.verifyHasKey(String key) Checks that there is a mapping for the given key in this map.Checks that the given child is mapped to the given key in this map.verifyKeyAbsent(String key) Checks that there is no mapping for the given key in this map.withValidator(Predicate<SignalCommand> validator) Wraps this signal with a validator.Methods inherited from class com.vaadin.signals.Signal
computed, createUsage, data, data, effect, fromJson, id, map, mergeValidators, nodeValue, peek, peekConfirmed, remove, runInTransaction, runInTransaction, runWithoutTransaction, runWithoutTransaction, submit, submit, submit, submitInsert, submitVoidOperation, toJson, tree, untracked, validator, value 
- 
Constructor Details
- 
MapSignal
Creates a new map signal with the given element type. The signal does not support clustering.- Parameters:
 elementType- the element type, notnull
 - 
MapSignal
protected MapSignal(SignalTree tree, Id id, Predicate<SignalCommand> validator, Class<T> elementType) Creates a new map signal instance with the given id and validator for the given signal tree with the given element type.- Parameters:
 tree- the signal tree that contains the value for this signal, notnullid- the id of the signal node within the signal tree, notnullvalidator- the validator to check operations submitted to this singal, notnullelementType- the element type, notnull
 
 - 
 - 
Method Details
- 
extractValue
Description copied from class:SignalExtracts the value for this signal from the given signal data node.- Specified by:
 extractValuein classSignal<Map<String,ValueSignal<T>>> - Parameters:
 data- the data node to extract the value from, ornullif the node doesn't exist in the tree- Returns:
 - the signal value
 
 - 
usageChangeValue
Description copied from class:SignalGets a reference value that will be used to determine whether a dependency based on previous usage should be invalidated. This is done by getting one reference value when the dependency occurs and then comparing that to the current value to determine if the value has changed.The implementation should return an object that changes if and only if the
Signal.value()of this signal changes.- Specified by:
 usageChangeValuein classSignal<Map<String,ValueSignal<T>>> - Parameters:
 data- the data node to read from, notnull- Returns:
 - a reference value to use for validity checks, may be
         
null 
 - 
put
Associates the given value with the given key. If an entry already exists for the given key, then that entry is updated. If no entry exists, then a new entry is created.The result of the returned operation will be resolved with the previous value at the time when this operation was confirmed. The previous value is
nullif no entry existed or if it existed with anullvalue.Note that this operation does not give direct access to the child signal that was created or updated. Use
putIfAbsent(String, Object)for that purpose.- Parameters:
 key- the key to use, notnullvalue- the value to set- Returns:
 - an operation containing the eventual result
 
 - 
putIfAbsent
Creates a new entry with the given value if an entry with the given key doesn't already exist. If an entry exists, then the given value is ignored. The returned operation has a reference to a signal that corresponds to the given key regardless of whether an entry existed for the key. The operation will be resolved as successful regardless of whether they key was already used.- Parameters:
 key- the key to use, notnullvalue- the value to set- Returns:
 - an operation containing a signal for the entry and the eventual result
 
 - 
remove
Removes the mapping for the given key. The operation will be resolved as successful if a mapping existed and as a failure if there was no mapping. In case of a successful operation, the result value will be the value associated with the key when the operation was processed.- Parameters:
 key- the key to use, notnull- Returns:
 - an operation containing the eventual result
 
 - 
clear
Removes all entries from this map. Note that is this map shares data with aNodeSignalthat has list children, then the list children will also be removed. - 
verifyKey
Checks that the given child is mapped to the given key in this map. This operation is only meaningful to use as a condition in atransaction. The result of the returned operation will be resolved as successful if the given child is a mapped to the given key in this map when the operation is processed.- Parameters:
 key- the key to check, notnullexpectedChild- the expected child signal, notnull- Returns:
 - an operation containing the eventual result
 
 - 
verifyHasKey
Checks that there is a mapping for the given key in this map. This operation is only meaningful to use as a condition in atransaction. The result of the returned operation will be resolved as successful if the given key has a mapping in this map when the operation is processed.- Parameters:
 key- the key to check, notnull- Returns:
 - an operation containing the eventual result
 
 - 
verifyKeyAbsent
Checks that there is no mapping for the given key in this map. This operation is only meaningful to use as a condition in atransaction. The result of the returned operation will be resolved as successful if the given key has no mapping in this map when the operation is processed.- Parameters:
 key- the key to check, notnull- Returns:
 - an operation containing the eventual result
 
 - 
withValidator
Wraps this signal with a validator. The validator is used to check all value changing commands issued through the new signal instance and all child signals. If this signal has a validator, then the new signal will use both validators. Note that due to the way validators are retained byasNode(), there's a possibility that the validator also receives commands that cannot be directly issued for a map signal or its children.This signal will keep its current configuration and changes applied through this instance will be visible through the wrapped instance.
- Parameters:
 validator- the validator to use, notnull- Returns:
 - a new map signal that uses the validator, not 
null 
 - 
asReadonly
Wraps this signal to not accept changes. Child value signals retrieved through the wrapped signal will also not accept changes.This signal will keep its current configuration and changes applied through this instance will be visible through the wrapped instance.
- Returns:
 - the new readonly map signal, not 
null 
 - 
asNode
Description copied from class:SignalConverts this signal into a node signal. This allows further conversion into any specific signal type through the methods inNodeSignal. The converted signal is backed by the same underlying data and uses the same validator as this signal. - 
equals
 - 
hashCode
public int hashCode() - 
toString
 
 -