com.vaadin.flow.server.

Interface VaadinContext

    • Method Summary

      All Methods
      Modifier and Type Method and Description
      default <T> T getAttribute(Class<T> type)

      Returns value of the specified attribute.

      <T> T getAttribute(Class<T> type, Supplier<T> defaultValueSupplier)

      Returns value of the specified attribute, creating a default value if not present.

      void removeAttribute(Class<?> clazz)

      Removes an attribute identified by the given type.

      <T> void setAttribute(T value)

      Sets the attribute value, overriding previously existing one.

    • Method Detail

      • getAttribute

        <T> T getAttribute(Class<T> type,
                           Supplier<T> defaultValueSupplier)

        Returns value of the specified attribute, creating a default value if not present.

        Parameters:

        type - Type of the attribute.

        defaultValueSupplier - Supplier of the default value, called when there is no value already present. May be null.

        Returns:

        Value of the specified attribute.

      • getAttribute

        default <T> T getAttribute(Class<T> type)

        Returns value of the specified attribute.

        Parameters:

        type - Type of the attribute.

        Returns:

        Value of the specified attribute.

      • setAttribute

        <T> void setAttribute(T value)

        Sets the attribute value, overriding previously existing one. Values are based on exact type, meaning only one attribute of given type is possible at any given time.

        Parameters:

        value - Value of the attribute. May not be null.

        See Also:

        for removing attributes.

      • removeAttribute

        void removeAttribute(Class<?> clazz)

        Removes an attribute identified by the given type. If the attribute does not exist, no action will be taken.

        Parameters:

        clazz - Attribute type.

        See Also:

        for setting attributes.