Package com.vaadin.data.provider
Interface DataKeyMapper<T>
-
- Type Parameters:
T- data type
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
KeyMapper
public interface DataKeyMapper<T> extends Serializable
DataKeyMapper to map data objects to key strings.- Since:
- 8.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Tget(String key)Gets the data object identified by given key.booleanhas(T dataObject)Check whether this key mapper contains the given data object.Stringkey(T dataObject)Gets the key for data object.voidrefresh(T dataObject)Updates any existing mappings of given data object.voidremove(T dataObject)Removes a data object from the key mapping.voidremoveAll()Removes all data objects from the key mapping.voidsetIdentifierGetter(ValueProvider<T,Object> identifierGetter)Takes identifier getter into use and updates existing mappings.
-
-
-
Method Detail
-
key
String key(T dataObject)
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
boolean has(T dataObject)
Check whether this key mapper contains the given data object.- Parameters:
dataObject- the data object to check- Returns:
trueif the given data object is contained in this key mapper,falseotherwise
-
get
T get(String key)
Gets the data object identified by given key.- Parameters:
key- key of a data object- Returns:
- identified data object;
nullif invalid key
-
remove
void remove(T dataObject)
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
void refresh(T dataObject)
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- Since:
- 8.1
-
setIdentifierGetter
void setIdentifierGetter(ValueProvider<T,Object> identifierGetter)
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.- Since:
- 8.1
-
-