Class InterceptionDecorationContext

java.lang.Object
org.jboss.weld.bean.proxy.InterceptionDecorationContext

public class InterceptionDecorationContext extends Object
A class that holds the interception (and decoration) contexts which are currently in progress.

An interception context is a set of CombinedInterceptorAndDecoratorStackMethodHandler references for which interception is currently suppressed (so that self-invocation is not possible). Such references are added as soon as a CombinedMethodHandler is executed in an interception context that does not hold it.

Classes may create new interception contexts as necessary (e.g. allowing client proxies to create new interception contexts in order to make circular references interceptable multiple times).

Author:
Marius Bogoevici
  • Method Details

    • peek

      Peeks the current top of the stack.
      Returns:
      the current top of the stack
      Throws:
      EmptyStackException
    • peekIfNotEmpty

      public static CombinedInterceptorAndDecoratorStackMethodHandler peekIfNotEmpty()
      Peeks the current top of the stack or returns null if the stack is empty
      Returns:
      the current top of the stack or returns null if the stack is empty
    • empty

      public static boolean empty()
      Indicates whether the stack is empty.
    • endInterceptorContext

      public static void endInterceptorContext()
    • startIfNotEmpty

      public static InterceptionDecorationContext.Stack startIfNotEmpty()
      This is called by client proxies. Calling a method on a client proxy means that we left the interception context of the calling bean. Therefore, client proxies call this method to start a new interception context of the called (possibly intercepted) bean. If however there is not interception context at the time the proxy is called (meaning the caller is not intercepted), there is no need to create new interception context. This is an optimization as the first startInterceptorContext call is expensive. If this method returns a non-null value, the caller of this method is required to call InterceptionDecorationContext.Stack.end() on the returned value.
    • startIfNotOnTop

      Pushes the given context to the stack if the given context is not on top of the stack already. If this method return a non-null value, the caller is responsible for calling endInterceptorContext() after the invocation finishes.
      Parameters:
      context - the given context
      Returns:
      true if the given context was pushed to the top of the stack, false if the given context was on top already
    • getStack

      public static InterceptionDecorationContext.Stack getStack()
      Gets the current Stack. If the stack is not set, a new empty instance is created and set.
      Returns: