Class RouteScopedContext

java.lang.Object
com.vaadin.cdi.util.AbstractContext
com.vaadin.cdi.context.RouteScopedContext
All Implemented Interfaces:
jakarta.enterprise.context.spi.Context

public class RouteScopedContext extends AbstractContext
Context for @RouteScoped beans.
Since:
10.0
  • Constructor Details

    • RouteScopedContext

      public RouteScopedContext(jakarta.enterprise.inject.spi.BeanManager beanManager)
      Creates a new route scoped context.
      Parameters:
      beanManager - the bean manager
  • Method Details

    • init

      public void init(jakarta.enterprise.inject.spi.BeanManager beanManager, Supplier<Boolean> isUIContextActive)
      Initializes the context by looking up its storage manager.
      Parameters:
      beanManager - the bean manager
      isUIContextActive - supplier telling whether the UI context is active, used to determine whether this context is active
    • getScope

      public Class<? extends Annotation> getScope()
    • isActive

      public boolean isActive()
    • getActiveContextualStorages

      protected List<ContextualStorage> getActiveContextualStorages()
      Description copied from class: AbstractContext
      Returns the contextual storages that are currently active for this context.

      The default implementation returns a list containing the storage returned by AbstractContext.getContextualStorage(Contextual, boolean) without creating it, so the only entry is null if no storage exists yet.

      Overrides:
      getActiveContextualStorages in class AbstractContext
      Returns:
      a list of the active contextual storages, entries may be null
    • getContextualStorage

      protected ContextualStorage getContextualStorage(jakarta.enterprise.context.spi.Contextual<?> contextual, boolean createIfNotExist)
      Description copied from class: AbstractContext
      An implementation has to return the underlying storage which contains the items held in the Context.
      Specified by:
      getContextualStorage in class AbstractContext
      Parameters:
      contextual - the contextual for which the storage is requested, may be null
      createIfNotExist - whether a ContextualStorage shall get created if it doesn't yet exist.
      Returns:
      the underlying storage