Package com.vaadin.flow.data.provider
Interface DataKeyMapper<T>
- Type Parameters:
T
- data type
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
ComboBoxDataCommunicator.SelectionPreservingKeyMapper
,KeyMapper
DataKeyMapper to map data objects to key strings.
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionGets the data object identified by given key.boolean
Check whether this key mapper contains the given data object.Gets the key for data object.void
Updates any existing mappings of given data object.void
Removes a data object from the key mapping.void
Removes all data objects from the key mapping.void
setIdentifierGetter
(ValueProvider<T, Object> identifierGetter) Takes identifier getter into use and updates existing mappings
-
Method Details
-
key
Gets the key for data object. If no key exists beforehand, a new key is created.- Parameters:
dataObject
- data object for key mapping- Returns:
- key for given data object
-
has
Check whether this key mapper contains the given data object.- Parameters:
dataObject
- the data object to check- Returns:
true
if the given data object is contained in this key mapper,false
otherwise
-
get
Gets the data object identified by given key.- Parameters:
key
- key of a data object- Returns:
- identified data object;
null
if invalid key
-
remove
Removes a data object from the key mapping. The key is also dropped. Dropped keys are not reused.- Parameters:
dataObject
- dropped data object
-
removeAll
void removeAll()Removes all data objects from the key mapping. The keys are also dropped. Dropped keys are not reused. -
refresh
Updates any existing mappings of given data object. The equality of two data objects is determined by the equality of their identifiers provided by the given value provider.- Parameters:
dataObject
- the data object to update
-
setIdentifierGetter
Takes identifier getter into use and updates existing mappings- Parameters:
identifierGetter
- has to return a unique key for every bean, and the returned key has to follow generalhashCode()
andequals()
contract, seeObject.hashCode()
for details.
-