Class ViewScopeContext

java.lang.Object
com.sun.faces.application.view.ViewScopeContext
All Implemented Interfaces:
jakarta.enterprise.context.spi.Context, Serializable

public class ViewScopeContext extends Object implements jakarta.enterprise.context.spi.Context, Serializable
The CDI context for CDI ViewScoped beans.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    get(jakarta.enterprise.context.spi.Contextual<T> contextual)
    Get the ViewScoped bean for the given contextual.
    <T> T
    get(jakarta.enterprise.context.spi.Contextual<T> contextual, jakarta.enterprise.context.spi.CreationalContext<T> creational)
    Get the existing instance of the ViewScoped bean for the given contextual or create a new one.
    Class<? extends Annotation>
    Get the class of the scope object.
    boolean
    Determine if the context is active.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ViewScopeContext

      public ViewScopeContext()
      Constructor.
  • Method Details

    • get

      public <T> T get(jakarta.enterprise.context.spi.Contextual<T> contextual)
      Get the ViewScoped bean for the given contextual.
      Specified by:
      get in interface jakarta.enterprise.context.spi.Context
      Type Parameters:
      T - the type.
      Parameters:
      contextual - the contextual.
      Returns:
      the view scoped bean, or null if not found.
    • get

      public <T> T get(jakarta.enterprise.context.spi.Contextual<T> contextual, jakarta.enterprise.context.spi.CreationalContext<T> creational)
      Get the existing instance of the ViewScoped bean for the given contextual or create a new one.
      Specified by:
      get in interface jakarta.enterprise.context.spi.Context
      Type Parameters:
      T - the type.
      Parameters:
      contextual - the contextual.
      creational - the creational.
      Returns:
      the instance.
      Throws:
      jakarta.enterprise.context.ContextNotActiveException - when the context is not active.
    • getScope

      public Class<? extends Annotation> getScope()
      Get the class of the scope object.
      Specified by:
      getScope in interface jakarta.enterprise.context.spi.Context
      Returns:
      the class.
    • isActive

      public boolean isActive()
      Determine if the context is active.
      Specified by:
      isActive in interface jakarta.enterprise.context.spi.Context
      Returns:
      true if there is a view root, false otherwise.