Interface ComponentContext<E extends Element,B extends TypedBuilder<E,B>>

Type Parameters:
E - the type of the element representing the component
B - the type of the builder used to build the component
All Superinterfaces:
IsElement<E>, TypedBuilder<E,B>

public interface ComponentContext<E extends Element,B extends TypedBuilder<E,B>> extends TypedBuilder<E,B>, IsElement<E>
The ComponentContext interface represents a context for a component, providing methods to store and retrieve arbitrary values associated with keys.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    get(String key)
    Retrieves the value associated with the given key from the ComponentContext.
    default <T> T
    get(String key, Supplier<T> defaultValue)
    Retrieves the value associated with the given key from the ComponentContext.
    default <T> T
    get(String key, T defaultValue)
    Retrieves the value associated with the given key from the ComponentContext.
    boolean
    has(String key)
    Determines whether a value is stored with the specified key.
    <T> B
    store(String key, T value)
    Stores a value associated with a key.

    Methods inherited from interface org.jboss.elemento.IsElement

    element

    Methods inherited from interface org.jboss.elemento.TypedBuilder

    that
  • Method Details

    • store

      <T> B store(String key, T value)
      Stores a value associated with a key.
      Type Parameters:
      T - the type of the value being stored
      Parameters:
      key - the key associated with the value
      value - the value to be stored
    • has

      boolean has(String key)
      Determines whether a value is stored with the specified key.
      Parameters:
      key - the key to check
      Returns:
      true if a value is stored with the specified key, false otherwise
    • get

      <T> T get(String key)
      Retrieves the value associated with the given key from the ComponentContext.
      Type Parameters:
      T - the type of the value being retrieved
      Parameters:
      key - the key associated with the value
      Returns:
      the value associated with the key, or null if no value is found
    • get

      default <T> T get(String key, T defaultValue)
      Retrieves the value associated with the given key from the ComponentContext.
      Type Parameters:
      T - the type of the value being retrieved
      Parameters:
      key - the key associated with the value
      defaultValue - the default value to be returned if no value is found with the specified key
      Returns:
      the value associated with the key, or the defaultValue if no value is found
    • get

      default <T> T get(String key, Supplier<T> defaultValue)
      Retrieves the value associated with the given key from the ComponentContext.
      Type Parameters:
      T - the type of the value being retrieved
      Parameters:
      key - the key associated with the value
      defaultValue - the default value to be returned if no value is found with the specified key
      Returns:
      the value associated with the key, or the defaultValue if no value is found