Class ComponentDataUtil

java.lang.Object
com.vaadin.featurepack.util.ComponentDataUtil

public class ComponentDataUtil extends Object
Utility class for storing data to components.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    static <KEY> Optional<?>
    remove(String dataKey, com.vaadin.flow.component.Component component, KEY mapKey)
    Get data from the component's data map.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 key
      DATA - the type of the data
      Parameters:
      dataKey - the key under which the data map is stored
      component - the component to which the data is added
      mapKey - the key under which the data is stored in the data map
      mapData - 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 stored
      component - the component from which the data is fetched
      mapKey - the key under which the data is stored in the data map
      Returns:
      the data wrapped in Optional stored in the data map under the given key