Package com.vaadin.featurepack.util
Class ComponentDataUtil
java.lang.Object
com.vaadin.featurepack.util.ComponentDataUtil
Utility class for storing data to components.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <KEY,DATA>
DATAPut data to the component's data map under the given key.static <KEY> Optional<?> Get data from the component's data map.
-
Constructor Details
-
ComponentDataUtil
public ComponentDataUtil()
-
-
Method Details
-
put
public static <KEY,DATA> DATA put(String dataKey, com.vaadin.flow.component.Component component, KEY mapKey, DATA mapData) Put data to the component's data map under the given key. If the data map does not exist, it is created.- Type Parameters:
KEY- the type of the keyDATA- the type of the data- Parameters:
dataKey- the key under which the data map is storedcomponent- the component to which the data is addedmapKey- the key under which the data is stored in the data mapmapData- the data to put to the data map- Returns:
- the given mapData
-
remove
public static <KEY> Optional<?> remove(String dataKey, com.vaadin.flow.component.Component component, KEY mapKey) Get data from the component's data map.- Type Parameters:
KEY- the type of the key- Parameters:
dataKey- the key under which the data map is storedcomponent- the component from which the data is fetchedmapKey- the key under which the data is stored in the data map- Returns:
- the data wrapped in
Optionalstored in the data map under the given key
-