Package org.jboss.weld.bean.proxy
Class InterceptionDecorationContext
java.lang.Object
org.jboss.weld.bean.proxy.InterceptionDecorationContext
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
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanempty()Indicates whether the stack is empty.static voidgetStack()Gets the current Stack.peek()Peeks the current top of the stack.Peeks the current top of the stack or returns null if the stack is emptyThis is called by client proxies.Pushes the given context to the stack if the given context is not on top of the stack already.
-
Method Details
-
peek
Peeks the current top of the stack.- Returns:
- the current top of the stack
- Throws:
EmptyStackException
-
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
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 callInterceptionDecorationContext.Stack.end()on the returned value. -
startIfNotOnTop
public static InterceptionDecorationContext.Stack startIfNotOnTop(CombinedInterceptorAndDecoratorStackMethodHandler context) 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 callingendInterceptorContext()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
Gets the current Stack. If the stack is not set, a new empty instance is created and set.- Returns:
-