Interface ContextManager.Builder
-
- Enclosing interface:
- ContextManager
public static interface ContextManager.Builder
Use this class to configure instances ofContextManager
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ContextManager.Builder
addDiscoveredContextManagerExtensions()
Load all discoverableContextManagerExtension
instances via theServiceLoader
mechanism on the current thread-contextClassLoader
(unless overridden byforClassLoader(ClassLoader)
).ContextManager.Builder
addDiscoveredThreadContextProviders()
Load all discoverableThreadContextProvider
instances via theServiceLoader
mechanism on the current thread-contextClassLoader
(unless overridden byforClassLoader(ClassLoader)
).ContextManager
build()
Creates a newContextManager
with the specified configuration.ContextManager.Builder
forClassLoader(java.lang.ClassLoader classLoader)
Use the givenClassLoader
foraddDiscoveredThreadContextProviders()
instead of the current thread-contextClassLoader
.ContextManager.Builder
withContextManagerExtensions(ContextManagerExtension... extensions)
Use the specifiedContextManagerExtension
instances.ContextManager.Builder
withThreadContextProviders(ThreadContextProvider... providers)
Use the specifiedThreadContextProvider
instances.
-
-
-
Method Detail
-
withThreadContextProviders
ContextManager.Builder withThreadContextProviders(ThreadContextProvider... providers)
Use the specifiedThreadContextProvider
instances.- Parameters:
providers
- theThreadContextProvider
instances to use.- Returns:
- this builder
-
addDiscoveredContextManagerExtensions
ContextManager.Builder addDiscoveredContextManagerExtensions()
Load all discoverableContextManagerExtension
instances via theServiceLoader
mechanism on the current thread-contextClassLoader
(unless overridden byforClassLoader(ClassLoader)
).- Returns:
- this builder
-
withContextManagerExtensions
ContextManager.Builder withContextManagerExtensions(ContextManagerExtension... extensions)
Use the specifiedContextManagerExtension
instances.- Parameters:
extensions
- theContextManagerExtension
instances to use.- Returns:
- this builder
-
addDiscoveredThreadContextProviders
ContextManager.Builder addDiscoveredThreadContextProviders()
Load all discoverableThreadContextProvider
instances via theServiceLoader
mechanism on the current thread-contextClassLoader
(unless overridden byforClassLoader(ClassLoader)
).- Returns:
- this builder
-
forClassLoader
ContextManager.Builder forClassLoader(java.lang.ClassLoader classLoader)
Use the givenClassLoader
foraddDiscoveredThreadContextProviders()
instead of the current thread-contextClassLoader
.- Parameters:
classLoader
- theClassLoader
to use foraddDiscoveredThreadContextProviders()
- Returns:
- this builder
-
build
ContextManager build()
Creates a new
ContextManager
with the specified configuration.Creating a
ContextManager
will load and invoke all relatedContextManagerExtension
as described in its documentation.- Returns:
- a new
ContextManager
with the specified configuration.
-
-