Class ViewElementBuilderContextHolder
java.lang.Object
com.foreach.across.modules.web.ui.ViewElementBuilderContextHolder
Holder class that associates a
ViewElementBuilderContext
with the current thread.
Used by block tag processors where nested blocks would build on top of the parent context.
This is different than the request scoped bean: the thread local render context is the one
actually being used by the current thread for the rendering, whereas the request scoped bean
represents the global context for the request (the root of the render context hierarchy).
The attached context is not inherited by child threads.- Since:
- 2.0.0
- Author:
- Arne Vandamme
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<ViewElementBuilderContext>
Removes the (optional) context attached to the current thread.static Optional<ViewElementBuilderContext>
static Optional<ViewElementBuilderContext>
setViewElementBuilderContext
(ViewElementBuilderContext ViewElementBuilderContext) Associate the given context with the current thread.static Optional<ViewElementBuilderContext>
setViewElementBuilderContext
(Optional<ViewElementBuilderContext> ViewElementBuilderContext) Associate the given context with the current thread.
-
Constructor Details
-
ViewElementBuilderContextHolder
public ViewElementBuilderContextHolder()
-
-
Method Details
-
setViewElementBuilderContext
public static Optional<ViewElementBuilderContext> setViewElementBuilderContext(ViewElementBuilderContext ViewElementBuilderContext) Associate the given context with the current thread. Will replace any previously configured context. If the context parameter isnull
, the attached context will be removed.- Parameters:
ViewElementBuilderContext
- instance- Returns:
- the context that has been removed
-
setViewElementBuilderContext
public static Optional<ViewElementBuilderContext> setViewElementBuilderContext(Optional<ViewElementBuilderContext> ViewElementBuilderContext) Associate the given context with the current thread. Will replace any previously configured context. If the context parameter isempty
, the attached context will be removed. Convenience method for easy resetting of previously retrieved context.- Parameters:
ViewElementBuilderContext
- instance- Returns:
- the context that has been removed
-
getViewElementBuilderContext
- Returns:
- the context attached to the current thread
-
clearViewElementBuilderContext
Removes the (optional) context attached to the current thread.- Returns:
- the context that has been removed
-